@golemui/gui-lit 0.12.2 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/abstract-calendar-YDgwwbqe.js +528 -0
- package/{accordion.element-81uTv6Ms.js → accordion.element-ChLmV6QT.js} +24 -22
- package/{alert.element-DWrS5ggK.js → alert.element-9QFlqjj9.js} +23 -21
- package/button.element-ATNRRDN3.js +121 -0
- package/calendar-P9DzVryu.js +96 -0
- package/{calendar.element-C1rLK7aY.js → calendar.element-O2of7VBr.js} +25 -22
- package/checkbox.element-DMmer4Jw.js +199 -0
- package/currency.element-C7SZkoPP.js +266 -0
- package/date-CG1562vW.js +786 -0
- package/date-input-VJG8lMVN.js +266 -0
- package/{date-picker.element-GNC8f3Qi.js → date-picker.element-Bcyhc0fb.js} +29 -25
- package/{date.element-Dzw-UJzC.js → date.element-DfXmcgZi.js} +25 -22
- package/{dropdown.element-CebROj9s.js → dropdown.element-DCUI5Y7I.js} +24 -22
- package/errors-QjKhr6mA.js +109 -0
- package/{flex.element-BMqqfxjI.js → flex.element-B0sG0YT1.js} +24 -22
- package/{grid.element-CBMoOuLt.js → grid.element-Bf5aEjkj.js} +24 -22
- package/index.js +2708 -1174
- package/index.umd.cjs +982 -108
- package/lib/components/accordion.element.d.ts +7 -7
- package/lib/components/alert.element.d.ts +6 -6
- package/lib/components/button.element.d.ts +6 -6
- package/lib/components/calendar.element.d.ts +6 -6
- package/lib/components/checkbox.element.d.ts +6 -6
- package/lib/components/currency.element.d.ts +6 -6
- package/lib/components/date-picker.element.d.ts +6 -6
- package/lib/components/date.element.d.ts +6 -6
- package/lib/components/dropdown.element.d.ts +6 -6
- package/lib/components/flex.element.d.ts +6 -6
- package/lib/components/grid.element.d.ts +6 -6
- package/lib/components/list.element.d.ts +6 -6
- package/lib/components/markdown-text.element.d.ts +6 -6
- package/lib/components/markdown.element.d.ts +6 -6
- package/lib/components/number.element.d.ts +6 -6
- package/lib/components/password.element.d.ts +6 -6
- package/lib/components/radiogroup.element.d.ts +6 -6
- package/lib/components/range-calendar.element.d.ts +6 -6
- package/lib/components/range-date-input.element.d.ts +6 -6
- package/lib/components/range-date-picker.element.d.ts +6 -6
- package/lib/components/renderer.element.d.ts +6 -6
- package/lib/components/repeater.element.d.ts +6 -6
- package/lib/components/select.element.d.ts +6 -6
- package/lib/components/tabs.element.d.ts +6 -6
- package/lib/components/textarea.element.d.ts +6 -6
- package/lib/components/textinput.element.d.ts +6 -6
- package/lib/components/toggle.element.d.ts +6 -6
- package/lib/widget.loaders.d.ts +2 -2
- package/list-CtFsv7GB.js +284 -0
- package/{list.element-DIIgN_Ww.js → list.element-G8RNRZXU.js} +30 -27
- package/markdown-text-X-BRJT6K.js +30 -0
- package/{markdown-text.element-DY7b-dU5.js → markdown-text.element-C_1OqrGa.js} +23 -20
- package/markdown.element-CT1JOOM3.js +596 -0
- package/number.element-HaXEg_7U.js +282 -0
- package/one-of-DifUsEYY.js +48 -0
- package/package.json +6 -6
- package/password.element-B4-0SCe4.js +238 -0
- package/radiogroup.element-DzHLgRh1.js +232 -0
- package/range-calendar-qpakwAba.js +326 -0
- package/{range-calendar.element-Bli9UfhN.js → range-calendar.element-C-4qqRGK.js} +20 -17
- package/range-date-input-CrNpOVHt.js +507 -0
- package/{range-date-input.element-BwPvGk5F.js → range-date-input.element-Iq5Y7uLQ.js} +20 -17
- package/{range-date-picker.element-DJQOwDPh.js → range-date-picker.element-4bg4Uraq.js} +29 -25
- package/{renderer.element-B99qD2mz.js → renderer.element-DMsheQGi.js} +19 -17
- package/{repeater.element-AaifWsOB.js → repeater.element-Ry8HyMfW.js} +41 -27
- package/select.element-DuGZjlZY.js +257 -0
- package/tabs-DzSCq_98.js +13 -0
- package/{tabs.element-k8JMNDXi.js → tabs.element-VLrtF1j5.js} +31 -29
- package/templates-Dk1jxLwS.js +75 -0
- package/textarea.element-C8yx2u0o.js +237 -0
- package/textinput.element-DKuplF1A.js +204 -0
- package/toggle.element-NXRrhALB.js +201 -0
- package/button.element-hjhVBamJ.js +0 -56
- package/checkbox.element-bu9_MvED.js +0 -65
- package/currency.element-Bxv2WxAx.js +0 -72
- package/default-list-item-renderer-DNVEjKSX.js +0 -23
- package/markdown.element-ZD_n4ObO.js +0 -73
- package/number.element-B0E7W2TK.js +0 -70
- package/password.element-C4_eLdUO.js +0 -71
- package/radiogroup.element-BD8qBNoO.js +0 -68
- package/select.element-BLxtqB0A.js +0 -74
- package/textarea.element-DgDwfzYP.js +0 -70
- package/textinput.element-DSLFDjfb.js +0 -67
- package/toggle.element-BLu6F99u.js +0 -65
package/index.umd.cjs
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
(function(y,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("@golemui/gui-components"),require("@golemui/gui-shared"),require("@golemui/core"),require("@golemui/lit"),require("lit"),require("lit/decorators.js"),require("@lit/context"),require("lit/directives/class-map.js"),require("rxjs"),require("lit-html/directives/repeat.js")):typeof define=="function"&&define.amd?define(["exports","@golemui/gui-components","@golemui/gui-shared","@golemui/core","@golemui/lit","lit","lit/decorators.js","@lit/context","lit/directives/class-map.js","rxjs","lit-html/directives/repeat.js"],E):(y=typeof globalThis<"u"?globalThis:y||self,E(y["gui-lit"]={},y.guiComponents,y.guiShared,y.core,y.Lit,y.lit,y.decorators_js,y.context,y.classMap_js,y.rxjs,y.repeat_js))})(this,(function(y,E,bt,te,ca,l,d,m,R,vt,J){"use strict";function pa(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const p=pa(ca),_t={button:async()=>(await Promise.resolve().then(()=>Wn)).ButtonElement,calendar:async()=>(await Promise.resolve().then(()=>Kn)).CalendarElement,rangeCalendar:async()=>(await Promise.resolve().then(()=>Xn)).RangeCalendarElement,rangeDateInput:async()=>(await Promise.resolve().then(()=>ts)).RangeDateInputElement,rangeDatePicker:async()=>(await Promise.resolve().then(()=>is)).RangeDatePickerElement,currency:async()=>(await Promise.resolve().then(()=>os)).CurrencyElement,dateInput:async()=>(await Promise.resolve().then(()=>ds)).DateElement,datePicker:async()=>(await Promise.resolve().then(()=>hs)).DatePickerElement,dropdown:async()=>(await Promise.resolve().then(()=>gs)).DropdownElement,list:async()=>(await Promise.resolve().then(()=>_s)).ListElement,markdown:async()=>(await Promise.resolve().then(()=>ws)).MarkdownElement,password:async()=>(await Promise.resolve().then(()=>xs)).PasswordElement,textinput:async()=>(await Promise.resolve().then(()=>zs)).TextinputElement,textarea:async()=>(await Promise.resolve().then(()=>ks)).TextareaElement,toggle:async()=>(await Promise.resolve().then(()=>Zs)).ToggleElement,checkbox:async()=>(await Promise.resolve().then(()=>As)).CheckboxElement,number:async()=>(await Promise.resolve().then(()=>js)).NumberElement,radiogroup:async()=>(await Promise.resolve().then(()=>Us)).RadiogroupElement,select:async()=>(await Promise.resolve().then(()=>Ws)).SelectElement,repeater:async()=>(await Promise.resolve().then(()=>Ys)).RepeaterElement,flex:async()=>(await Promise.resolve().then(()=>eo)).FlexElement,grid:async()=>(await Promise.resolve().then(()=>ro)).GridElement,tabs:async()=>(await Promise.resolve().then(()=>so)).TabsElement,accordion:async()=>(await Promise.resolve().then(()=>lo)).AccordionElement,alert:async()=>(await Promise.resolve().then(()=>ho)).AlertElement,markdownText:async()=>(await Promise.resolve().then(()=>go)).MarkdownTextElement,renderer:async()=>(await Promise.resolve().then(()=>_o)).RendererElement};function c(e,t,a){function r(o,u){if(o._zod||Object.defineProperty(o,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),o._zod.traits.has(e))return;o._zod.traits.add(e),t(o,u);const h=s.prototype,f=Object.keys(h);for(let g=0;g<f.length;g++){const v=f[g];v in o||(o[v]=h[v].bind(o))}}const i=a?.Parent??Object;class n extends i{}Object.defineProperty(n,"name",{value:e});function s(o){var u;const h=a?.Parent?new n:this;r(h,o),(u=h._zod).deferred??(u.deferred=[]);for(const f of h._zod.deferred)f();return h}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:o=>a?.Parent&&o instanceof a.Parent?!0:o?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class G extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class $t extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const ha={};function q(e){return ha}function Me(e,t){return typeof t=="bigint"?t.toString():t}function je(e){return e==null}function qe(e){const t=e.startsWith("^")?1:0,a=e.endsWith("$")?e.length-1:e.length;return e.slice(t,a)}const yt=Symbol("evaluating");function _(e,t,a){let r;Object.defineProperty(e,t,{get(){if(r!==yt)return r===void 0&&(r=yt,r=a()),r},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function ma(...e){const t={};for(const a of e){const r=Object.getOwnPropertyDescriptors(a);Object.assign(t,r)}return Object.defineProperties({},t)}function fa(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const wt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Dt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ne(e){if(Dt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const a=t.prototype;return!(Dt(a)===!1||Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")===!1)}function Ct(e){return Ne(e)?{...e}:Array.isArray(e)?[...e]:e}function Ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xt(e,t,a){const r=new e._zod.constr(t??e._zod.def);return(!t||a?.parent)&&(r._zod.parent=e),r}function b(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}const ga={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function K(e,t=0){if(e.aborted===!0)return!0;for(let a=t;a<e.issues.length;a++)if(e.issues[a]?.continue!==!0)return!0;return!1}function ba(e,t){return t.map(a=>{var r;return(r=a).path??(r.path=[]),a.path.unshift(e),a})}function Pe(e){return typeof e=="string"?e:e?.message}function N(e,t,a){const r={...e,path:e.path??[]};if(!e.message){const i=Pe(e.inst?._zod.def?.error?.(e))??Pe(t?.error?.(e))??Pe(a.customError?.(e))??Pe(a.localeError?.(e))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ve(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ae(...e){const[t,a,r]=e;return typeof t=="string"?{message:t,code:"custom",input:a,inst:r}:{...t}}const Ot=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Me,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Pt=c("$ZodError",Ot),ze=c("$ZodError",Ot,{Parent:Error});function va(e,t=a=>a.message){const a={},r=[];for(const i of e.issues)i.path.length>0?(a[i.path[0]]=a[i.path[0]]||[],a[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:a}}function _a(e,t=a=>a.message){const a={_errors:[]},r=i=>{for(const n of i.issues)if(n.code==="invalid_union"&&n.errors.length)n.errors.map(s=>r({issues:s}));else if(n.code==="invalid_key")r({issues:n.issues});else if(n.code==="invalid_element")r({issues:n.issues});else if(n.path.length===0)a._errors.push(t(n));else{let s=a,o=0;for(;o<n.path.length;){const u=n.path[o];o===n.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(t(n))):s[u]=s[u]||{_errors:[]},s=s[u],o++}}};return r(e),a}const Ee=e=>(t,a,r,i)=>{const n=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:a,issues:[]},n);if(s instanceof Promise)throw new G;if(s.issues.length){const o=new(i?.Err??e)(s.issues.map(u=>N(u,n,q())));throw wt(o,i?.callee),o}return s.value},$a=Ee(ze),Ie=e=>async(t,a,r,i)=>{const n=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:a,issues:[]},n);if(s instanceof Promise&&(s=await s),s.issues.length){const o=new(i?.Err??e)(s.issues.map(u=>N(u,n,q())));throw wt(o,i?.callee),o}return s.value},ya=Ie(ze),ke=e=>(t,a,r)=>{const i=r?{...r,async:!1}:{async:!1},n=t._zod.run({value:a,issues:[]},i);if(n instanceof Promise)throw new G;return n.issues.length?{success:!1,error:new(e??Pt)(n.issues.map(s=>N(s,i,q())))}:{success:!0,data:n.value}},zt=ke(ze),Se=e=>async(t,a,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let n=t._zod.run({value:a,issues:[]},i);return n instanceof Promise&&(n=await n),n.issues.length?{success:!1,error:new e(n.issues.map(s=>N(s,i,q())))}:{success:!0,data:n.value}},Et=Se(ze),wa=e=>(t,a,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ee(e)(t,a,i)},Da=e=>(t,a,r)=>Ee(e)(t,a,r),Ca=e=>async(t,a,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ie(e)(t,a,i)},xa=e=>async(t,a,r)=>Ie(e)(t,a,r),Oa=e=>(t,a,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ke(e)(t,a,i)},Pa=e=>(t,a,r)=>ke(e)(t,a,r),za=e=>async(t,a,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Se(e)(t,a,i)},Ea=e=>async(t,a,r)=>Se(e)(t,a,r),Ia=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,It=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ka=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Sa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ta=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Za=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,kt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",La=new RegExp(`^${kt}$`);function St(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ra(e){return new RegExp(`^${St(e)}$`)}function Aa(e){const t=St({precision:e.precision}),a=["Z"];e.local&&a.push(""),e.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${a.join("|")})`;return new RegExp(`^${kt}T(?:${r})$`)}const Fa=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ma=/^-?\d+$/,ja=/^-?\d+(?:\.\d+)?$/,qa=/^(?:true|false)$/i,Na=/^[^A-Z]*$/,Ua=/^[^a-z]*$/,I=c("$ZodCheck",(e,t)=>{var a;e._zod??(e._zod={}),e._zod.def=t,(a=e._zod).onattach??(a.onattach=[])}),Tt={number:"number",bigint:"bigint",object:"date"},Va=c("$ZodCheckLessThan",(e,t)=>{I.init(e,t);const a=Tt[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,n=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:a,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ba=c("$ZodCheckGreaterThan",(e,t)=>{I.init(e,t);const a=Tt[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,n=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:a,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wa=c("$ZodCheckNumberFormat",(e,t)=>{I.init(e,t),t.format=t.format||"float64";const a=t.format?.includes("int"),r=a?"int":"number",[i,n]=ga[t.format];e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,o.minimum=i,o.maximum=n,a&&(o.pattern=Ma)}),e._zod.check=s=>{const o=s.value;if(a){if(!Number.isInteger(o)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:o,inst:e});return}if(!Number.isSafeInteger(o)){o>0?s.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}o<i&&s.issues.push({origin:"number",input:o,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),o>n&&s.issues.push({origin:"number",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Ja=c("$ZodCheckMaxLength",(e,t)=>{var a;I.init(e,t),(a=e._zod.def).when??(a.when=r=>{const i=r.value;return!je(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const s=Ve(i);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ga=c("$ZodCheckMinLength",(e,t)=>{var a;I.init(e,t),(a=e._zod.def).when??(a.when=r=>{const i=r.value;return!je(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const s=Ve(i);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ka=c("$ZodCheckLengthEquals",(e,t)=>{var a;I.init(e,t),(a=e._zod.def).when??(a.when=r=>{const i=r.value;return!je(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=r=>{const i=r.value,n=i.length;if(n===t.length)return;const s=Ve(i),o=n>t.length;r.issues.push({origin:s,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Te=c("$ZodCheckStringFormat",(e,t)=>{var a,r;I.init(e,t),e._zod.onattach.push(i=>{const n=i._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(a=e._zod).check??(a.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ha=c("$ZodCheckRegex",(e,t)=>{Te.init(e,t),e._zod.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ya=c("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Na),Te.init(e,t)}),Xa=c("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ua),Te.init(e,t)}),Qa=c("$ZodCheckIncludes",(e,t)=>{I.init(e,t);const a=Ue(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${a}`:a);t.pattern=r,e._zod.onattach.push(i=>{const n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),er=c("$ZodCheckStartsWith",(e,t)=>{I.init(e,t);const a=new RegExp(`^${Ue(t.prefix)}.*`);t.pattern??(t.pattern=a),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(a)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),tr=c("$ZodCheckEndsWith",(e,t)=>{I.init(e,t);const a=new RegExp(`.*${Ue(t.suffix)}$`);t.pattern??(t.pattern=a),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(a)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),ar=c("$ZodCheckOverwrite",(e,t)=>{I.init(e,t),e._zod.check=a=>{a.value=t.tx(a.value)}}),rr={major:4,minor:3,patch:6},D=c("$ZodType",(e,t)=>{var a;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rr;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const n of i._zod.onattach)n(e);if(r.length===0)(a=e._zod).deferred??(a.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,o,u)=>{let h=K(s),f;for(const g of o){if(g._zod.def.when){if(!g._zod.def.when(s))continue}else if(h)continue;const v=s.issues.length,$=g._zod.check(s);if($ instanceof Promise&&u?.async===!1)throw new G;if(f||$ instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await $,s.issues.length!==v&&(h||(h=K(s,v)))});else{if(s.issues.length===v)continue;h||(h=K(s,v))}}return f?f.then(()=>s):s},n=(s,o,u)=>{if(K(s))return s.aborted=!0,s;const h=i(o,r,u);if(h instanceof Promise){if(u.async===!1)throw new G;return h.then(f=>e._zod.parse(f,u))}return e._zod.parse(h,u)};e._zod.run=(s,o)=>{if(o.skipChecks)return e._zod.parse(s,o);if(o.direction==="backward"){const h=e._zod.parse({value:s.value,issues:[]},{...o,skipChecks:!0});return h instanceof Promise?h.then(f=>n(f,s,o)):n(h,s,o)}const u=e._zod.parse(s,o);if(u instanceof Promise){if(o.async===!1)throw new G;return u.then(h=>i(h,r,o))}return i(u,r,o)}}_(e,"~standard",()=>({validate:i=>{try{const n=zt(e,i);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Et(e,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Be=c("$ZodString",(e,t)=>{D.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Fa(e._zod.bag),e._zod.parse=(a,r)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),S=c("$ZodStringFormat",(e,t)=>{Te.init(e,t),Be.init(e,t)}),ir=c("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=It(r))}else t.pattern??(t.pattern=It());S.init(e,t)}),nr=c("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ka),S.init(e,t)}),sr=c("$ZodURL",(e,t)=>{S.init(e,t),e._zod.check=a=>{try{const r=a.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:a.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:a.value,inst:e,continue:!t.abort})),t.normalize?a.value=i.href:a.value=r;return}catch{a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:e,continue:!t.abort})}}}),or=c("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Aa(t)),S.init(e,t)}),ur=c("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=La),S.init(e,t)}),lr=c("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ra(t)),S.init(e,t)}),dr=c("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ia),S.init(e,t)}),cr=c("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Sa),S.init(e,t),e._zod.bag.format="ipv4"}),pr=c("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ta),S.init(e,t),e._zod.bag.format="ipv6",e._zod.check=a=>{try{new URL(`http://[${a.value}]`)}catch{a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:e,continue:!t.abort})}}}),hr=c("$ZodCustomStringFormat",(e,t)=>{S.init(e,t),e._zod.check=a=>{t.fn(a.value)||a.issues.push({code:"invalid_format",format:t.format,input:a.value,inst:e,continue:!t.abort})}}),Zt=c("$ZodNumber",(e,t)=>{D.init(e,t),e._zod.pattern=e._zod.bag.pattern??ja,e._zod.parse=(a,r)=>{if(t.coerce)try{a.value=Number(a.value)}catch{}const i=a.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return a;const n=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return a.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...n?{received:n}:{}}),a}}),mr=c("$ZodNumberFormat",(e,t)=>{Wa.init(e,t),Zt.init(e,t)}),fr=c("$ZodBoolean",(e,t)=>{D.init(e,t),e._zod.pattern=qa,e._zod.parse=(a,r)=>{if(t.coerce)try{a.value=!!a.value}catch{}const i=a.value;return typeof i=="boolean"||a.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),a}}),gr=c("$ZodAny",(e,t)=>{D.init(e,t),e._zod.parse=a=>a});function Lt(e,t,a){e.issues.length&&t.issues.push(...ba(a,e.issues)),t.value[a]=e.value}const Rt=c("$ZodArray",(e,t)=>{D.init(e,t),e._zod.parse=(a,r)=>{const i=a.value;if(!Array.isArray(i))return a.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),a;a.value=Array(i.length);const n=[];for(let s=0;s<i.length;s++){const o=i[s],u=t.element._zod.run({value:o,issues:[]},r);u instanceof Promise?n.push(u.then(h=>Lt(h,a,s))):Lt(u,a,s)}return n.length?Promise.all(n).then(()=>a):a}});function At(e,t,a,r){for(const n of e)if(n.issues.length===0)return t.value=n.value,t;const i=e.filter(n=>!K(n));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:a,errors:e.map(n=>n.issues.map(s=>N(s,r,q())))}),t)}const br=c("$ZodUnion",(e,t)=>{D.init(e,t),_(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),_(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),_(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),_(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${i.map(n=>qe(n.source)).join("|")})$`)}});const a=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,n)=>{if(a)return r(i,n);let s=!1;const o=[];for(const u of t.options){const h=u._zod.run({value:i.value,issues:[]},n);if(h instanceof Promise)o.push(h),s=!0;else{if(h.issues.length===0)return h;o.push(h)}}return s?Promise.all(o).then(u=>At(u,i,e,n)):At(o,i,e,n)}}),vr=c("$ZodIntersection",(e,t)=>{D.init(e,t),e._zod.parse=(a,r)=>{const i=a.value,n=t.left._zod.run({value:i,issues:[]},r),s=t.right._zod.run({value:i,issues:[]},r);return n instanceof Promise||s instanceof Promise?Promise.all([n,s]).then(([u,h])=>Ft(a,u,h)):Ft(a,n,s)}});function We(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ne(e)&&Ne(t)){const a=Object.keys(t),r=Object.keys(e).filter(n=>a.indexOf(n)!==-1),i={...e,...t};for(const n of r){const s=We(e[n],t[n]);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};i[n]=s.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let r=0;r<e.length;r++){const i=e[r],n=t[r],s=We(i,n);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};a.push(s.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}function Ft(e,t,a){const r=new Map;let i;for(const o of t.issues)if(o.code==="unrecognized_keys"){i??(i=o);for(const u of o.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(o);for(const o of a.issues)if(o.code==="unrecognized_keys")for(const u of o.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(o);const n=[...r].filter(([,o])=>o.l&&o.r).map(([o])=>o);if(n.length&&i&&e.issues.push({...i,keys:n}),K(e))return e;const s=We(t.value,a.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const _r=c("$ZodTransform",(e,t)=>{D.init(e,t),e._zod.parse=(a,r)=>{if(r.direction==="backward")throw new $t(e.constructor.name);const i=t.transform(a.value,a);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(a.value=s,a));if(i instanceof Promise)throw new G;return a.value=i,a}});function Mt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Je=c("$ZodOptional",(e,t)=>{D.init(e,t),e._zod.optin="optional",e._zod.optout="optional",_(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),_(e._zod,"pattern",()=>{const a=t.innerType._zod.pattern;return a?new RegExp(`^(${qe(a.source)})?$`):void 0}),e._zod.parse=(a,r)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(a,r);return i instanceof Promise?i.then(n=>Mt(n,a.value)):Mt(i,a.value)}return a.value===void 0?a:t.innerType._zod.run(a,r)}}),$r=c("$ZodExactOptional",(e,t)=>{Je.init(e,t),_(e._zod,"values",()=>t.innerType._zod.values),_(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(a,r)=>t.innerType._zod.run(a,r)}),yr=c("$ZodNullable",(e,t)=>{D.init(e,t),_(e._zod,"optin",()=>t.innerType._zod.optin),_(e._zod,"optout",()=>t.innerType._zod.optout),_(e._zod,"pattern",()=>{const a=t.innerType._zod.pattern;return a?new RegExp(`^(${qe(a.source)}|null)$`):void 0}),_(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(a,r)=>a.value===null?a:t.innerType._zod.run(a,r)}),wr=c("$ZodDefault",(e,t)=>{D.init(e,t),e._zod.optin="optional",_(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,r)=>{if(r.direction==="backward")return t.innerType._zod.run(a,r);if(a.value===void 0)return a.value=t.defaultValue,a;const i=t.innerType._zod.run(a,r);return i instanceof Promise?i.then(n=>jt(n,t)):jt(i,t)}});function jt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Dr=c("$ZodPrefault",(e,t)=>{D.init(e,t),e._zod.optin="optional",_(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,r)=>(r.direction==="backward"||a.value===void 0&&(a.value=t.defaultValue),t.innerType._zod.run(a,r))}),Cr=c("$ZodNonOptional",(e,t)=>{D.init(e,t),_(e._zod,"values",()=>{const a=t.innerType._zod.values;return a?new Set([...a].filter(r=>r!==void 0)):void 0}),e._zod.parse=(a,r)=>{const i=t.innerType._zod.run(a,r);return i instanceof Promise?i.then(n=>qt(n,e)):qt(i,e)}});function qt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const xr=c("$ZodCatch",(e,t)=>{D.init(e,t),_(e._zod,"optin",()=>t.innerType._zod.optin),_(e._zod,"optout",()=>t.innerType._zod.optout),_(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(a,r)=>{if(r.direction==="backward")return t.innerType._zod.run(a,r);const i=t.innerType._zod.run(a,r);return i instanceof Promise?i.then(n=>(a.value=n.value,n.issues.length&&(a.value=t.catchValue({...a,error:{issues:n.issues.map(s=>N(s,r,q()))},input:a.value}),a.issues=[]),a)):(a.value=i.value,i.issues.length&&(a.value=t.catchValue({...a,error:{issues:i.issues.map(n=>N(n,r,q()))},input:a.value}),a.issues=[]),a)}}),Or=c("$ZodPipe",(e,t)=>{D.init(e,t),_(e._zod,"values",()=>t.in._zod.values),_(e._zod,"optin",()=>t.in._zod.optin),_(e._zod,"optout",()=>t.out._zod.optout),_(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(a,r)=>{if(r.direction==="backward"){const n=t.out._zod.run(a,r);return n instanceof Promise?n.then(s=>Ze(s,t.in,r)):Ze(n,t.in,r)}const i=t.in._zod.run(a,r);return i instanceof Promise?i.then(n=>Ze(n,t.out,r)):Ze(i,t.out,r)}});function Ze(e,t,a){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},a)}const Pr=c("$ZodReadonly",(e,t)=>{D.init(e,t),_(e._zod,"propValues",()=>t.innerType._zod.propValues),_(e._zod,"values",()=>t.innerType._zod.values),_(e._zod,"optin",()=>t.innerType?._zod?.optin),_(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(a,r)=>{if(r.direction==="backward")return t.innerType._zod.run(a,r);const i=t.innerType._zod.run(a,r);return i instanceof Promise?i.then(Nt):Nt(i)}});function Nt(e){return e.value=Object.freeze(e.value),e}const Ut=c("$ZodCustom",(e,t)=>{I.init(e,t),D.init(e,t),e._zod.parse=(a,r)=>a,e._zod.check=a=>{const r=a.value,i=t.fn(r);if(i instanceof Promise)return i.then(n=>Vt(n,a,r,e));Vt(i,a,r,e)}});function Vt(e,t,a,r){if(!e){const i={code:"custom",input:a,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(ae(i))}}var Bt;class zr{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...a){const r=a[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const a=this._map.get(t);return a&&typeof a=="object"&&"id"in a&&this._idmap.delete(a.id),this._map.delete(t),this}get(t){const a=t._zod.parent;if(a){const r={...this.get(a)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Er(){return new zr}(Bt=globalThis).__zod_globalRegistry??(Bt.__zod_globalRegistry=Er());const re=globalThis.__zod_globalRegistry;function Ir(e,t){return new e({type:"string",...b(t)})}function kr(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...b(t)})}function Sr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...b(t)})}function Tr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...b(t)})}function Zr(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(t)})}function Lr(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(t)})}function Rr(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(t)})}function Ar(e,t){return new e({type:"string",format:"date",check:"string_format",...b(t)})}function Fr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...b(t)})}function Mr(e,t){return new e({type:"string",format:"duration",check:"string_format",...b(t)})}function jr(e,t){return new e({type:"number",checks:[],...b(t)})}function qr(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...b(t)})}function Nr(e,t){return new e({type:"boolean",...b(t)})}function Ur(e){return new e({type:"any"})}function Vr(e,t){return new Va({check:"less_than",...b(t),value:e,inclusive:!0})}function Br(e,t){return new Ba({check:"greater_than",...b(t),value:e,inclusive:!0})}function Le(e,t){return new Ja({check:"max_length",...b(t),maximum:e})}function H(e,t){return new Ga({check:"min_length",...b(t),minimum:e})}function Wt(e,t){return new Ka({check:"length_equals",...b(t),length:e})}function Jt(e,t){return new Ha({check:"string_format",format:"regex",...b(t),pattern:e})}function Wr(e){return new Ya({check:"string_format",format:"lowercase",...b(e)})}function Jr(e){return new Xa({check:"string_format",format:"uppercase",...b(e)})}function Gr(e,t){return new Qa({check:"string_format",format:"includes",...b(t),includes:e})}function Kr(e,t){return new er({check:"string_format",format:"starts_with",...b(t),prefix:e})}function Hr(e,t){return new tr({check:"string_format",format:"ends_with",...b(t),suffix:e})}function Y(e){return new ar({check:"overwrite",tx:e})}function Yr(e){return Y(t=>t.normalize(e))}function Xr(){return Y(e=>e.trim())}function Qr(){return Y(e=>e.toLowerCase())}function ei(){return Y(e=>e.toUpperCase())}function ti(){return Y(e=>fa(e))}function ai(e,t,a){return new e({type:"array",element:t,...b(a)})}function Gt(e,t,a){return new e({type:"custom",check:"custom",fn:t,...b(a)})}function Kt(e){const t=ri(a=>(a.addIssue=r=>{if(typeof r=="string")a.issues.push(ae(r,a.value,t._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=a.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),a.issues.push(ae(i))}},e(a.value,a)));return t}function ri(e,t){const a=new I({check:"custom",...b(t)});return a._zod.check=e,a}function ii(e,t,a,r={}){const i=b(r),n={...b(r),check:"string_format",type:"string",format:t,fn:typeof a=="function"?a:o=>a.test(o),...i};return a instanceof RegExp&&(n.pattern=a),new e(n)}function Ht(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??re,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function x(e,t,a={path:[],schemaPath:[]}){var r;const i=e._zod.def,n=t.seen.get(e);if(n)return n.count++,a.schemaPath.includes(e)&&(n.cycle=a.path),n.schema;const s={schema:{},count:1,cycle:void 0,path:a.path};t.seen.set(e,s);const o=e._zod.toJSONSchema?.();if(o)s.schema=o;else{const f={...a,schemaPath:[...a.schemaPath,e],path:a.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,f);else{const v=s.schema,$=t.processors[i.type];if(!$)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);$(e,t,v,f)}const g=e._zod.parent;g&&(s.ref||(s.ref=g),x(g,t,f),t.seen.get(g).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&O(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&s.schema._prefault&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Yt(e,t){const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const s of e.seen.entries()){const o=e.metadataRegistry.get(s[0])?.id;if(o){const u=r.get(o);if(u&&u!==s[0])throw new Error(`Duplicate schema id "${o}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(o,s[0])}}const i=s=>{const o=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(s[0])?.id,v=e.external.uri??(ee=>ee);if(g)return{ref:v(g)};const $=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=$,{defId:$,ref:`${v("__shared")}#/${o}/${$}`}}if(s[1]===a)return{ref:"#"};const h=`#/${o}/`,f=s[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:h+f}},n=s=>{if(s[1].schema.$ref)return;const o=s[1],{ref:u,defId:h}=i(s);o.def={...o.schema},h&&(o.defId=h);const f=o.schema;for(const g in f)delete f[g];f.$ref=u};if(e.cycles==="throw")for(const s of e.seen.entries()){const o=s[1];if(o.cycle)throw new Error(`Cycle detected: #/${o.cycle?.join("/")}/<root>
|
|
1
|
+
(function(S,Xe){typeof exports=="object"&&typeof module<"u"?Xe(exports,require("@golemui/gui-shared"),require("@golemui/lit"),require("@golemui/core"),require("lit"),require("lit/decorators.js"),require("@lit/context"),require("rxjs"),require("lit/directives/class-map.js"),require("lit-html/directives/repeat.js"),require("lit/directives/live.js"),require("lit-html/directives/style-map.js"),require("lit/directives/if-defined.js"),require("lit/directives/unsafe-html.js")):typeof define=="function"&&define.amd?define(["exports","@golemui/gui-shared","@golemui/lit","@golemui/core","lit","lit/decorators.js","@lit/context","rxjs","lit/directives/class-map.js","lit-html/directives/repeat.js","lit/directives/live.js","lit-html/directives/style-map.js","lit/directives/if-defined.js","lit/directives/unsafe-html.js"],Xe):(S=typeof globalThis<"u"?globalThis:S||self,Xe(S["gui-lit"]={},S.guiShared,S.lit$1,S.core,S.lit,S.decorators_js,S.context,S.rxjs,S.classMap_js,S.repeat_js,S.live_js,S.styleMap_js,S.ifDefined_js,S.unsafeHtml_js))})(this,(function(S,Xe,y,Ze,d,o,D,xi,$,Q,Ei,Vt,Ut,Ba){"use strict";const Pi={button:async()=>(await Promise.resolve().then(()=>_l)).ButtonElement,calendar:async()=>(await Promise.resolve().then(()=>Ll)).CalendarElement,rangeCalendar:async()=>(await Promise.resolve().then(()=>Nl)).RangeCalendarElement,rangeDateInput:async()=>(await Promise.resolve().then(()=>Ul)).RangeDateInputElement,rangeDatePicker:async()=>(await Promise.resolve().then(()=>Hl)).RangeDatePickerElement,currency:async()=>(await Promise.resolve().then(()=>Ql)).CurrencyElement,dateInput:async()=>(await Promise.resolve().then(()=>ad)).DateElement,datePicker:async()=>(await Promise.resolve().then(()=>rd)).DatePickerElement,dropdown:async()=>(await Promise.resolve().then(()=>vd)).DropdownElement,list:async()=>(await Promise.resolve().then(()=>kd)).ListElement,markdown:async()=>(await Promise.resolve().then(()=>Pd)).MarkdownElement,password:async()=>(await Promise.resolve().then(()=>Md)).PasswordElement,textinput:async()=>(await Promise.resolve().then(()=>qd)).TextinputElement,textarea:async()=>(await Promise.resolve().then(()=>Wd)).TextareaElement,toggle:async()=>(await Promise.resolve().then(()=>Jd)).ToggleElement,checkbox:async()=>(await Promise.resolve().then(()=>tu)).CheckboxElement,number:async()=>(await Promise.resolve().then(()=>ru)).NumberElement,radiogroup:async()=>(await Promise.resolve().then(()=>mu)).RadiogroupElement,select:async()=>(await Promise.resolve().then(()=>bu)).SelectElement,repeater:async()=>(await Promise.resolve().then(()=>_u)).RepeaterElement,flex:async()=>(await Promise.resolve().then(()=>Ou)).FlexElement,grid:async()=>(await Promise.resolve().then(()=>Pu)).GridElement,tabs:async()=>(await Promise.resolve().then(()=>Tu)).TabsElement,accordion:async()=>(await Promise.resolve().then(()=>zu)).AccordionElement,alert:async()=>(await Promise.resolve().then(()=>Nu)).AlertElement,markdownText:async()=>(await Promise.resolve().then(()=>Zu)).MarkdownTextElement,renderer:async()=>(await Promise.resolve().then(()=>Wu)).RendererElement},St={ACTIONS:"ACTIONS",LAYOUTS:"LAYOUTS",DISPLAYS:"DISPLAYS"};function Za(e){return function(t,i=()=>!0){return{kind:"leaf",selectorType:e,matcher:i,config:t}}}const Ot=new Map;function Ii(e,t){if(Ot.has(e))throw new Error(`Item type "${e}" is already registered.`);Ot.set(e,t)}function Qe(e){const t=Ot.get(e);if(!t)throw new Error(`No handler registered for item type "${e}". Did you forget to import the registration module?`);return t}function Ai(e){return Ot.has(e)}function C(e){const t=l=>{if(!e.sensibleDefaults)return{};let u={...e.sensibleDefaults.base};for(const p of l){const c=p.config;for(const h of e.sensibleDefaults.fields){const f=h;c[f]!=null&&(u={...u,[f]:c[f]})}}return u},i=(l,u)=>e.sensibleDefaults?e.sensibleDefaults.apply(l,u):l,n=l=>{switch(e.entryShape){case"bare":return{baseDef:l};case"keyed":{const u=l;return{baseDef:u.def,path:u.key}}case"compound":{const u=l;return{baseDef:u.def,children:u.children}}}},a={rollUpSensibleDefaults:t,applySensibleDefaults:i,mapToWidget:e.mapToWidget,parseEntry:n,...e.afterMerge?{afterMerge:e.afterMerge}:{},...e.buildCustomWidget?{buildCustomWidget:e.buildCustomWidget}:{},...e.getChildren?{getChildren:e.getChildren}:{}};Ii(e.itemType,a);const s=Za(e.itemType);return{gsl:s,gslByUid:(l,u)=>s(u,(p=>p.uid===l))}}function Va(e){return e?e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase()):""}function G(e,t){return e.label!=null||t.suppressAutomaticLabels||!e.path?e:{...e,label:Va(e.path)}}function Ce(e,t){return e.placeholder!=null||t.suppressAutomaticPlaceholders||!e.path?e:{...e,placeholder:e.path}}const Ua=(e,t)=>({type:"ITEMS",itemType:St.DISPLAYS,items:[{render:e}],tags:[]});class Wa{deepMerge(t,i){if(i==null)return t;if(t==null||typeof t!="object"||typeof i!="object"||Array.isArray(t)||Array.isArray(i))return i;const n={...t};for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&(typeof i[a]=="object"&&!Array.isArray(i[a])&&i[a]!==null&&typeof t[a]=="object"&&!Array.isArray(t[a])&&t[a]!==null?n[a]=this.deepMerge(t[a],i[a]):n[a]=i[a]);return n}}const Ga=new Wa;function Ha(e,t){return{items:[e],type:"ITEMS",itemType:St.ACTIONS,tags:t??[]}}const Ya=e=>Ha({uid:"#submit",label:"Submit"}),Ti={INPUTS:new Set(["INPUTS","TEXTAREA","PASSWORD","SELECT","DROPDOWN","RADIOGROUP","CHECKBOX","CALENDAR","DATE_INPUT","DATE_PICKER","RANGE_CALENDAR","RANGE_DATE_INPUT","RANGE_DATE_PICKER","CURRENCY","MARKDOWN","LIST","CUSTOM_INPUT","REPEATER"]),ACTIONS:new Set(["ACTIONS","CUSTOM_ACTION"]),DISPLAYS:new Set(["DISPLAYS","ALERTS","CUSTOM_DISPLAY"]),LAYOUTS:new Set(["LAYOUTS","TABS","ACCORDION","CUSTOM_LAYOUT"])};function Ka(e,t){const i=Ti[e];return i?i.has(t):e===t}class Ja{resolve(t,i){const n=[];for(const s of i)s.kind==="aggregated"?this.collectFromAggregated(s,t,n):this.collectFromLeaf(s,t,n);const a=this.rollUpSensibleDefaults(n);return{leafSelectors:n,sensibleDefaults:a}}collectFromAggregated(t,i,n){if(t.matcher(i))for(const a of t.children)this.collectFromLeaf(a,i,n)}collectFromLeaf(t,i,n){Ka(t.selectorType,i.itemType??"")&&t.matcher(i)&&n.push(t)}rollUpSensibleDefaults(t){const i=new Map,n=(s,r)=>{const l=i.get(s)??[];l.push(r),i.set(s,l)};for(const s of t){const r=Ti[s.selectorType];if(r)for(const l of r)n(l,s);else n(s.selectorType,s)}const a={};for(const[s,r]of i)Ai(s)&&(a[s]=Qe(s).rollUpSensibleDefaults(r));return a}}const Xa=new Ja;class Qa{constructor(t){this.objectUtils=t}merge(t,i,n){let a={},s=null;typeof t=="function"&&(s=t);const r=this.collectDecorators(n);for(const p of r){if(s!=null){s=this.composeRuntimeFunctions(s,p);continue}if(typeof p=="function"){const c=p({...a,...typeof t=="function"?{}:t});if(typeof c=="function"){s=this.createPromotedFunction(a,t,c,i,n);continue}a=this.objectUtils.deepMerge(a,c)}else a=this.objectUtils.deepMerge(a,p)}if(s!=null)return{kind:"dynamic",fn:this.wrapWithSensibleDefaults(s,a,i,n)};const l=this.objectUtils.deepMerge(t,a);return{kind:"static",def:this.applySensibleDefaults({...l},i,n)}}collectDecorators(t){const i=[];for(const n of t.leafSelectors){const a=n.config;a.override!=null&&i.push(a.override)}return i}applySensibleDefaults(t,i,n){if(!Ai(i))return t;const a=n.sensibleDefaults[i]??{};return Qe(i).applySensibleDefaults(t,a)}createPromotedFunction(t,i,n,a,s){return r=>{const l=n(r);let u=this.objectUtils.deepMerge(t,l);return u=this.objectUtils.deepMerge(u,i),this.applySensibleDefaults(u,a,s)}}wrapWithSensibleDefaults(t,i,n,a){return s=>{let r=t(s);return Object.keys(i).length>0&&(r=this.objectUtils.deepMerge(i,r)),this.applySensibleDefaults(r,n,a)}}composeRuntimeFunctions(t,i){return typeof i=="function"?n=>{const a=t(n),s=i(a);return typeof s=="function"?s(n):this.objectUtils.deepMerge(s,a)}:n=>{const a=t(n);return this.objectUtils.deepMerge(a,i)}}}const ja=new Qa(Ga);class en{mapToWidget(t,i){if(t.kind==="dynamic"){const n=t.fn;return(a=>{const s=n(a);return this.mapStaticDef(s,i)})}return this.mapStaticDef(t.def,i)}mapStaticDef(t,i){const n=Qe(i).mapToWidget(t);return this.applyBaseWidgetFields(n,t)}applyBaseWidgetFields(t,i){return i.size!=null&&(t.size=i.size),i.defaultValue!=null&&t.kind==="input"&&(t.defaultValue=i.defaultValue),i.on!=null&&(t.on=i.on),i.include!=null&&(t.include=i.include),i.exclude!=null&&(t.exclude=i.exclude),t}}const tn=new en;class an{normalizeSelectors(t){const i=Array.isArray(t)?t:[t],n=[],a=[];for(const s of i)s.kind==="leaf"?a.push(s):n.push(s);return a.length>0&&n.unshift({kind:"aggregated",matcher:()=>!0,children:a}),n}extractFormConfig(){return{suppressAutomaticStack:!1,suppressAutomaticSubmit:!1,onSubmit:t=>console.log("Form submitted:",t)}}}const nn=new an,Li={onLoad:"load",onChange:"change",onFilter:"filter",onBlur:"blur"},sn=Object.keys(Li);class rn{extractOnClickFromMergeResult(t,i,n,a){if(t.kind==="dynamic"){const l=t.fn;return{kind:"dynamic",fn:p=>{const c=l(p);return this.wireOnClick(c,i,n,a)}}}const s=t.def;return{kind:"static",def:this.wireOnClick(s,i,n,a)}}countSubmitButtons(t){let i=0;for(const n of t){if(n.type!=="ITEMS")continue;const a=Qe(n.itemType);for(const s of n.items){const r=a.getChildren?.(s);if(r&&(i+=this.countSubmitButtons(r)),n.itemType===St.ACTIONS){if(typeof s=="function")continue;const l=s;(l.uid==="#submit"||l.onClick==="submit")&&i++}}}return i}wireOnClick(t,i,n,a){const s=t.uid==="#submit"||t.onClick==="submit",r=s?"#submit":a.next(),l=s?"submit":r,u=t.onClick,c=(typeof u=="function"?u:void 0)??(s?n.onSubmit:void 0);if(c){i.set(l,g=>c(g.data));const{onClick:h,...f}=t;return{...f,uid:r,on:{click:l}}}if(s){const{onClick:h,...f}=t;return{...f,uid:r,on:{click:"submit"}}}if(typeof u=="string"){const{onClick:h,...f}=t;return{...f,uid:r,on:{click:u}}}return{...t,uid:r}}wireInputLayoutEvents(t,i,n){if(t.kind==="dynamic"){const s=t.fn;return{kind:"dynamic",fn:l=>{const u=s(l);return this.wireEventProperties(u,i,n)}}}return{kind:"static",def:this.wireEventProperties(t.def,i,n)}}wireEventProperties(t,i,n){const a={...t.on||{}};let s=!1;const r={...t};for(const l of sn){const u=t[l];if(u==null)continue;const p=Li[l];if(typeof u=="function"){const c=n.next();i.set(c,u),a[p]=c,s=!0}else typeof u=="string"&&(a[p]=u,s=!0);delete r[l]}return s&&(r.on=a),r}}const xt=new rn,on={input:new Set(["disabled","readonly","label","validator","size"]),action:new Set(["disabled","label","size"]),layout:new Set(["size"]),display:new Set([])},Mi={onChange:"change",onLoad:"load",onFilter:"filter",onClick:"click"};class ln{extractFromMergeResult(t,i){const n={};for(const l of i){const u=l.targetState,p=l.config,c=p.override&&typeof p.override!="function"?p.override:p;n[u]={...n[u]||{},...c}}if(t.kind==="dynamic"){const l=t.fn;return{cleanedResult:{kind:"dynamic",fn:p=>{const c=l(p),{states:h,...f}=c;return f}},stateData:{stateOverrides:n}}}const{states:a,...s}=t.def,r={};for(const[l,u]of Object.entries(n))r[l]={...u};if(a)for(const[l,u]of Object.entries(a))r[l]={...r[l]||{},...u};return{cleanedResult:{kind:"static",def:s},stateData:{stateOverrides:r}}}applyToWidget(t,i,n,a){const{stateOverrides:s}=i;if(Object.keys(s).length===0)return t;const r={...t},l=t.kind,u=on[l]||new Set;t.props&&(r.props={...t.props}),t.on&&(r.on={...t.on});for(const[p,c]of Object.entries(s))for(const[h,f]of Object.entries(c))h==="visible"?this.applyVisibility(r,p,f):Mi[h]?this.applyStateEvent(r,p,h,f,n,a):u.has(h)?r[`${h}.${p}`]=f:(r.props||(r.props={}),r.props[`${h}.${p}`]=f);return r}hasStateData(t){return Object.keys(t.stateOverrides).length>0}applyVisibility(t,i,n){if(n){const a=t.include?.in||[];t.include={...t.include||{},in:[...a,i]}}else{const a=t.exclude?.from||[];t.exclude={...t.exclude||{},from:[...a,i]}}}applyStateEvent(t,i,n,a,s,r){const l=Mi[n];if(t.on||(t.on={}),typeof a=="function"){const u=r.next();s.set(u,a),t.on[`${l}.${i}`]=u}else typeof a=="string"&&(t.on[`${l}.${i}`]=a)}}const dn=new ln;function un(){let e=0;return{next:()=>`event_${e++}`}}class pn{constructor(t,i,n,a,s){this.resolver=t,this.merger=i,this.mapper=n,this.eventWiring=a,this.stateExpansion=s}walkAndMap(t,i,n){const a=new Map,s=un(),r={value:0},l=new Set;return{widgets:this.walkItems(t,i,a,n,s,r,l),eventRegistry:a}}walkItems(t,i,n,a,s,r,l){return t.flatMap(u=>{if(u.type!=="ITEMS")throw new Error("Unexpected gui shortcut type");return u.items.map(p=>this.processItem(p,u.itemType,u.tags,i,n,a,s,r,l))})}processItem(t,i,n,a,s,r,l,u,p){const c=i,h=Qe(i),f=h.parseEntry(t),g=this.buildBaseDef(f),_=this.buildDecoratorForMatching(g,c,n),T=this.resolver.resolve(_,a),Ra=T.leafSelectors.filter(re=>re.targetState!=null),Na={leafSelectors:T.leafSelectors.filter(re=>re.targetState==null),sensibleDefaults:T.sensibleDefaults};let Be=this.merger.merge(g,c,Na);h.afterMerge&&(Be=h.afterMerge(Be,{eventRegistry:s,formConfig:r,eventIdGenerator:l})),Be=this.eventWiring.wireInputLayoutEvents(Be,s,l);const{cleanedResult:qa,stateData:Oi}=this.stateExpansion.extractFromMergeResult(Be,Ra);let _e;if(h.buildCustomWidget){const re=this.buildCustomWidgetContext(f.children,a,s,r,l,u,p);_e=this.buildCustomWidget(h,qa,re)}else _e=this.mapper.mapToWidget(qa,c);if(typeof _e!="function"){const re=_e;re.uid||(re.path&&!p.has(re.path)?(re.uid=re.path,p.add(re.path)):re.uid=`dx_${u.value++}`)}if(this.stateExpansion.hasStateData(Oi))if(typeof _e=="function"){const re=_e;_e=(Gu=>{const Hu=re(Gu);return this.stateExpansion.applyToWidget(Hu,Oi,s,l)})}else _e=this.stateExpansion.applyToWidget(_e,Oi,s,l);return _e}buildCustomWidgetContext(t,i,n,a,s,r,l){return{children:t,mapStaticDef:(u,p)=>this.mapper.mapStaticDef(u,p),walkChildren:u=>this.walkItems(u,i,n,a,s,r,l)}}buildCustomWidget(t,i,n){return t.buildCustomWidget(i,n)}buildBaseDef(t){const i=t.baseDef;return typeof i=="function"?n=>{const s=i(n??{});return t.path!=null?{...s,path:t.path}:s}:t.path!=null?{...i,path:t.path}:i}buildDecoratorForMatching(t,i,n){if(typeof t=="function")return{itemType:i,tags:[...n]};const a=[...n,..."tags"in t&&t.tags?t.tags:[]],s="uid"in t?t.uid:void 0,r="type"in t?t.type:void 0;return{itemType:i,tags:a,uid:s,type:r}}}function Z(e){const{uid:t,path:i,label:n,disabled:a,readonly:s,defaultValue:r,tags:l,type:u,size:p,onLoad:c,onChange:h,onFilter:f,on:g,states:_,include:T,exclude:Ra,validator:Na,...Be}=e;return Be}function te(e,t){return typeof e=="function"?e:{type:t,...e??{}}}function cn(e){switch(e.type){case"text":return mn(e);case"number":return yn(e);case"boolean":return hn(e);default:throw new Error(`Unsupported field type "${e.type}"`)}}function hn(e){const t=Z(e);return{uid:e.uid??"",kind:"input",type:"toggle",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"boolean")}:{},props:t}}function mn(e){const t=Z(e);return{uid:e.uid??"",kind:"input",type:"textinput",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},props:{placeholder:t.placeholder??"",...t},validator:te(e.validator,"string")}}function yn(e){const t=Z(e);return{uid:e.uid??"",kind:"input",type:"number",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},props:{placeholder:t.placeholder??"",...t},validator:te(e.validator,"number")}}C({itemType:"INPUTS",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>{let i=G(e,t);return i=Ce(i,t),i}},mapToWidget:cn});function fn(e){const{uid:t,label:i,disabled:n,on:a,onClick:s,data:r,type:l,tags:u,size:p,include:c,exclude:h,states:f,...g}=e;return{uid:t??"",kind:"action",type:"button",disabled:n,label:i,...a!=null?{on:a}:{},props:g}}C({itemType:"ACTIONS",entryShape:"bare",mapToWidget:fn,afterMerge:(e,t)=>xt.extractOnClickFromMergeResult(e,t.eventRegistry,t.formConfig,t.eventIdGenerator)});function gn(e){const{uid:t,widgetName:i,tags:n,size:a,onChange:s,include:r,exclude:l,...u}=e,{on:p,...c}=u;return{uid:t??"",kind:"layout",type:i??"flex",props:{direction:c.direction??"column",...c},children:[]}}function Dn(e,t){const i=t.walkChildren(t.children??[]);if(e.kind==="static")return{...t.mapStaticDef(e.def,"LAYOUTS"),children:i};const n=e.fn;return(a=>{const s=n(a);return{...t.mapStaticDef(s,"LAYOUTS"),children:i}})}function bn(e){return e.children}C({itemType:"LAYOUTS",entryShape:"compound",mapToWidget:gn,buildCustomWidget:Dn,getChildren:bn});function vn(e){return{uid:"",kind:"display",type:"renderer",props:{render:e.render}}}function wn(e,t){if(e.kind==="static"){const n=e.def;return(a=>({uid:"",kind:"display",type:"renderer",...n.include!=null?{include:n.include}:{},...n.exclude!=null?{exclude:n.exclude}:{},props:{render:n.render(a??{})}}))}const i=e.fn;return(n=>{const a=i(n);return{uid:"",kind:"display",type:"renderer",...a.include!=null?{include:a.include}:{},...a.exclude!=null?{exclude:a.exclude}:{},props:{render:a.render(n??{})}}})}C({itemType:"DISPLAYS",entryShape:"bare",mapToWidget:vn,buildCustomWidget:wn}),C({itemType:"CALENDAR",entryShape:"bare",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>G(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"calendar",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"string")}:{},props:Z(e)})}),C({itemType:"TEXTAREA",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>Ce(G(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"textarea",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"string")}:{},props:Z(e)})}),C({itemType:"PASSWORD",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>Ce(G(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"password",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"string")}:{},props:Z(e)})}),C({itemType:"CHECKBOX",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>G(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"checkbox",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"boolean")}:{},props:Z(e)})}),C({itemType:"DATE_INPUT",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>G(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"dateInput",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"string")}:{},props:Z(e)})}),C({itemType:"CURRENCY",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>Ce(G(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"currency",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"number")}:{},props:Z(e)})}),C({itemType:"RANGE_CALENDAR",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>G(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"rangeCalendar",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"array")}:{},props:Z(e)})}),C({itemType:"SELECT",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>Ce(G(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"select",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:e.validator}:{},props:Z(e)})}),C({itemType:"RADIOGROUP",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>G(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"radiogroup",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:e.validator}:{},props:Z(e)})});function $n(e){return{uid:e.uid??"",kind:"layout",type:"tabs",props:{tabs:e.tabs,renderMode:e.renderMode??"all",...e.defaultOpen!=null?{defaultOpen:e.defaultOpen}:{}},children:[]}}function kn(e,t){const i=t.walkChildren(t.children??[]);if(e.kind==="static")return{...t.mapStaticDef(e.def,"TABS"),children:i};const n=e.fn;return(a=>{const s=n(a);return{...t.mapStaticDef(s,"TABS"),children:i}})}function _n(e){return e.children}C({itemType:"TABS",entryShape:"compound",mapToWidget:$n,buildCustomWidget:kn,getChildren:_n}),C({itemType:"LIST",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>G(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"list",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:e.validator}:{},props:Z(e)})}),C({itemType:"ALERTS",entryShape:"bare",mapToWidget:e=>({uid:e.uid??"",kind:"display",type:"alert",props:{text:e.text,...e.level!=null?{level:e.level}:{}}})}),C({itemType:"DATE_PICKER",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>Ce(G(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"datePicker",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"string")}:{},props:Z(e)})}),C({itemType:"DROPDOWN",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>Ce(G(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"dropdown",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:e.validator}:{},props:Z(e)})});function Cn(e){return{uid:e.uid??"",kind:"layout",type:"accordion",props:{sections:e.sections,renderMode:e.renderMode??"all",...e.singleOpen!=null?{singleOpen:e.singleOpen}:{},...e.defaultOpen!=null?{defaultOpen:e.defaultOpen}:{}},children:[]}}function Sn(e,t){const i=t.walkChildren(t.children??[]);if(e.kind==="static")return{...t.mapStaticDef(e.def,"ACCORDION"),children:i};const n=e.fn;return(a=>{const s=n(a);return{...t.mapStaticDef(s,"ACCORDION"),children:i}})}function On(e){return e.children}C({itemType:"ACCORDION",entryShape:"compound",mapToWidget:Cn,buildCustomWidget:Sn,getChildren:On});function xn(e){const t={};return e.addLabel!=null&&(t.addLabel=e.addLabel),e.removeLabel!=null&&(t.removeLabel=e.removeLabel),e.limit!=null&&(t.limit=e.limit),e.title!=null&&(t.title=e.title),e.addButtonIcon!=null&&(t.addButtonIcon=e.addButtonIcon),e.removeButtonIcon!=null&&(t.removeButtonIcon=e.removeButtonIcon),t}function En(e){return{uid:e.uid??"",kind:"input",type:"repeater",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"array")}:{},props:{...xn(e),template:{kind:"layout",type:"flex",children:[],props:{direction:"column"}}}}}function Wt(e,t){for(const i of e){if(typeof i=="function")continue;const n=i;typeof n.path=="string"&&n.path&&(n.path=t+n.path),"children"in n&&Array.isArray(n.children)&&Wt(n.children,t);const a=n.props;a?.template?.children&&Array.isArray(a.template.children)&&Wt(a.template.children,t)}}function Pn(e,t){const i=t.walkChildren(t.children??[]),n=e.kind==="static"?e.def.path??"":e.fn({})?.path??"";n&&Wt(i,n+".items.");const a={kind:"layout",type:"flex",uid:"",children:i,props:{direction:"column"}};if(e.kind==="static"){const r=t.mapStaticDef(e.def,"REPEATER");return{...r,props:{...r.props,template:a}}}const s=e.fn;return(r=>{const l=s(r),u=t.mapStaticDef(l,"REPEATER");return{...u,props:{...u.props,template:a}}})}function In(e){return{baseDef:e.def,path:e.key,children:e.children}}function An(e){return e.children}Ii("REPEATER",{parseEntry:In,rollUpSensibleDefaults:()=>({}),applySensibleDefaults:e=>e,mapToWidget:En,buildCustomWidget:Pn,getChildren:An}),C({itemType:"MARKDOWN",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>Ce(G(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"markdown",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"string")}:{},props:Z(e)})}),C({itemType:"RANGE_DATE_INPUT",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>G(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"rangeDateInput",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"array")}:{},props:Z(e)})}),C({itemType:"RANGE_DATE_PICKER",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1,suppressAutomaticPlaceholders:!1},fields:["suppressAutomaticLabels","suppressAutomaticPlaceholders"],apply:(e,t)=>Ce(G(e,t),t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:"rangeDatePicker",path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.validator!=null?{validator:te(e.validator,"array")}:{},props:Z(e)})}),C({itemType:"CUSTOM_DISPLAY",entryShape:"bare",mapToWidget:e=>({uid:e.uid??"",kind:"display",type:e.customType,props:e.props??{}})}),C({itemType:"CUSTOM_INPUT",entryShape:"keyed",sensibleDefaults:{base:{suppressAutomaticLabels:!1},fields:["suppressAutomaticLabels"],apply:(e,t)=>G(e,t)},mapToWidget:e=>({uid:e.uid??"",kind:"input",type:e.customType,path:e.path??"",...e.label!=null?{label:e.label}:{},...e.disabled!=null?{disabled:e.disabled}:{},...e.readonly!=null?{readonly:e.readonly}:{},...e.defaultValue!=null?{defaultValue:e.defaultValue}:{},...e.validator!=null?{validator:e.validator}:{},props:e.props??{}})}),C({itemType:"CUSTOM_ACTION",entryShape:"bare",mapToWidget:e=>{const{uid:t,label:i,disabled:n,on:a,onClick:s,data:r,customType:l,tags:u,size:p,include:c,exclude:h,states:f,props:g,..._}=e;return{uid:t??"",kind:"action",type:e.customType,label:i,disabled:n,...a!=null?{on:a}:{},props:{...g,..._}}},afterMerge:(e,t)=>xt.extractOnClickFromMergeResult(e,t.eventRegistry,t.formConfig,t.eventIdGenerator)});function Tn(e){return{uid:e.uid??"",kind:"layout",type:e.customType,props:e.props??{},children:[]}}function Ln(e,t){const i=t.walkChildren(t.children??[]);if(e.kind==="static")return{...t.mapStaticDef(e.def,"CUSTOM_LAYOUT"),children:i};const n=e.fn;return(a=>{const s=n(a);return{...t.mapStaticDef(s,"CUSTOM_LAYOUT"),children:i}})}function Mn(e){return e.children}C({itemType:"CUSTOM_LAYOUT",entryShape:"compound",mapToWidget:Tn,buildCustomWidget:Ln,getChildren:Mn});class zn{constructor(t,i,n){this.selectorNormalizer=t,this.eventWiring=i,this.walker=n}processDxFacade(t,i=[],n){const{defs:a,gslSelectors:s,formConfig:r}=this.prepareForm(t,i,n),{widgets:l,eventRegistry:u}=this.walker.walkAndMap(a,s,r),p=l[0];return this.buildResult({form:p},u,r)}prepareForm(t,i,n){const s=(Array.isArray(t)?[...t]:[t]).map(p=>typeof p=="function"?Ua(p):p),r=this.selectorNormalizer.normalizeSelectors(i),l={...this.selectorNormalizer.extractFormConfig(),...n},u=this.eventWiring.countSubmitButtons(s);if(u>1)throw new Error(`Only one submit button is allowed per form, but ${u} were found. A button is a submit button if it has uid: '#submit' or onClick: 'submit'.`);if(!l.suppressAutomaticSubmit&&u===0&&s.push(Ya()),!l.suppressAutomaticStack){const p={def:{uid:"#root",direction:"column",widgetName:"flex"},children:s};return{defs:[{type:"ITEMS",itemType:St.LAYOUTS,items:[p],tags:[]}],gslSelectors:r,formConfig:l}}return{defs:s,gslSelectors:r,formConfig:l}}convertStateNames(t){const i={};for(const[n,a]of Object.entries(t))i[n.replace(/\$/g,":")]=a;return i}buildResult(t,i,n){n.states&&Object.keys(n.states).length>0&&(t={...t,states:this.convertStateNames(n.states)});const a={form:t};return i.size>0&&(a.events=s=>{const r=i.get(s.name);if(r){const l=p=>{if(p&&typeof p=="object"&&"path"in p&&!("type"in p)){const{path:c,...h}=p;for(const[f,g]of Object.entries(h))s.callback({type:"OVERRIDE_WIDGET_PROP",payload:{path:c,prop:f,value:g}})}else s.callback(p)},u={...s,callback:l,update:l};r(u)}}),n.dependencies&&(a.dependencies=n.dependencies),n.widgetLoaders&&(a.widgetLoaders=n.widgetLoaders),n.validateOn&&(a.validateOn=n.validateOn),n.itemRenderers&&(a.itemRenderers=n.itemRenderers),a}}const Fn=new pn(Xa,ja,tn,xt,dn),Rn=new zn(nn,xt,Fn);function Nn(e){return typeof e=="function"?!0:Array.isArray(e)?e.length===0||e.every(zi):zi(e)}function zi(e){if(typeof e=="function")return!0;if(e===null||typeof e!="object")return!1;const t=e;return t.type==="ITEMS"&&typeof t.itemType=="string"}const Fi=Object.freeze({}),qn=Object.freeze({}),Ri=new WeakMap;function Gt(e,t){return e==null?t:typeof e=="object"?e:{}}function Bn(e,t,i){if(!Nn(e))return{formDef:e};const n=Gt(e,Fi),a=Gt(t,Fi),s=Gt(i,qn);let r=Ri.get(n);r||(r=new WeakMap,Ri.set(n,r));let l=r.get(a);l||(l=new WeakMap,r.set(a,l));const u=l.get(s);if(u)return u;const p=Rn.processDxFacade(e,t,i),c={formDef:p.form,formEvent:p.events,dependencies:p.dependencies,widgetLoaders:p.widgetLoaders,validateOn:p.validateOn,itemRenderers:p.itemRenderers};return l.set(s,c),c}function Zn(e,t){if(e!=null&&typeof e=="object"&&"__rid"in e)return e.__rid;const i=t();return Object.defineProperty(e,"__rid",{value:i,enumerable:!1,configurable:!1}),i}function m(e,t,i){function n(l,u){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:u,constr:r,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,u);const p=r.prototype,c=Object.keys(p);for(let h=0;h<c.length;h++){const f=c[h];f in l||(l[f]=p[f].bind(l))}}const a=i?.Parent??Object;class s extends a{}Object.defineProperty(s,"name",{value:e});function r(l){var u;const p=i?.Parent?new s:this;n(p,l),(u=p._zod).deferred??(u.deferred=[]);for(const c of p._zod.deferred)c();return p}return Object.defineProperty(r,"init",{value:n}),Object.defineProperty(r,Symbol.hasInstance,{value:l=>i?.Parent&&l instanceof i.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(r,"name",{value:e}),r}class Ve extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ni extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Vn={};function Ae(e){return Vn}function Ht(e,t){return typeof t=="bigint"?t.toString():t}function Yt(e){return e==null}function Kt(e){const t=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(t,i)}const qi=Symbol("evaluating");function k(e,t,i){let n;Object.defineProperty(e,t,{get(){if(n!==qi)return n===void 0&&(n=qi,n=i()),n},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function Un(...e){const t={};for(const i of e){const n=Object.getOwnPropertyDescriptors(i);Object.assign(t,n)}return Object.defineProperties({},t)}function Wn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Bi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Zi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Jt(e){if(Zi(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const i=t.prototype;return!(Zi(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function Vi(e){return Jt(e)?{...e}:Array.isArray(e)?[...e]:e}function Xt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ui(e,t,i){const n=new e._zod.constr(t??e._zod.def);return(!t||i?.parent)&&(n._zod.parent=e),n}function v(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}const Gn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ue(e,t=0){if(e.aborted===!0)return!0;for(let i=t;i<e.issues.length;i++)if(e.issues[i]?.continue!==!0)return!0;return!1}function Hn(e,t){return t.map(i=>{var n;return(n=i).path??(n.path=[]),i.path.unshift(e),i})}function Et(e){return typeof e=="string"?e:e?.message}function Te(e,t,i){const n={...e,path:e.path??[]};if(!e.message){const a=Et(e.inst?._zod.def?.error?.(e))??Et(t?.error?.(e))??Et(i.customError?.(e))??Et(i.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Qt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function je(...e){const[t,i,n]=e;return typeof t=="string"?{message:t,code:"custom",input:i,inst:n}:{...t}}const Wi=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ht,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Gi=m("$ZodError",Wi),Pt=m("$ZodError",Wi,{Parent:Error});function Yn(e,t=i=>i.message){const i={},n=[];for(const a of e.issues)a.path.length>0?(i[a.path[0]]=i[a.path[0]]||[],i[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:i}}function Kn(e,t=i=>i.message){const i={_errors:[]},n=a=>{for(const s of a.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(r=>n({issues:r}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)i._errors.push(t(s));else{let r=i,l=0;for(;l<s.path.length;){const u=s.path[l];l===s.path.length-1?(r[u]=r[u]||{_errors:[]},r[u]._errors.push(t(s))):r[u]=r[u]||{_errors:[]},r=r[u],l++}}};return n(e),i}const It=e=>(t,i,n,a)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},r=t._zod.run({value:i,issues:[]},s);if(r instanceof Promise)throw new Ve;if(r.issues.length){const l=new(a?.Err??e)(r.issues.map(u=>Te(u,s,Ae())));throw Bi(l,a?.callee),l}return r.value},Jn=It(Pt),At=e=>async(t,i,n,a)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let r=t._zod.run({value:i,issues:[]},s);if(r instanceof Promise&&(r=await r),r.issues.length){const l=new(a?.Err??e)(r.issues.map(u=>Te(u,s,Ae())));throw Bi(l,a?.callee),l}return r.value},Xn=At(Pt),Tt=e=>(t,i,n)=>{const a=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:i,issues:[]},a);if(s instanceof Promise)throw new Ve;return s.issues.length?{success:!1,error:new(e??Gi)(s.issues.map(r=>Te(r,a,Ae())))}:{success:!0,data:s.value}},Hi=Tt(Pt),Lt=e=>async(t,i,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:i,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(r=>Te(r,a,Ae())))}:{success:!0,data:s.value}},Yi=Lt(Pt),Qn=e=>(t,i,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return It(e)(t,i,a)},jn=e=>(t,i,n)=>It(e)(t,i,n),es=e=>async(t,i,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return At(e)(t,i,a)},ts=e=>async(t,i,n)=>At(e)(t,i,n),is=e=>(t,i,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Tt(e)(t,i,a)},as=e=>(t,i,n)=>Tt(e)(t,i,n),ns=e=>async(t,i,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Lt(e)(t,i,a)},ss=e=>async(t,i,n)=>Lt(e)(t,i,n),rs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ki=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,os=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ls=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ds=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,us=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Ji="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ps=new RegExp(`^${Ji}$`);function Xi(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cs(e){return new RegExp(`^${Xi(e)}$`)}function hs(e){const t=Xi({precision:e.precision}),i=["Z"];e.local&&i.push(""),e.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${i.join("|")})`;return new RegExp(`^${Ji}T(?:${n})$`)}const ms=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ys=/^-?\d+$/,fs=/^-?\d+(?:\.\d+)?$/,gs=/^(?:true|false)$/i,Ds=/^[^A-Z]*$/,bs=/^[^a-z]*$/,he=m("$ZodCheck",(e,t)=>{var i;e._zod??(e._zod={}),e._zod.def=t,(i=e._zod).onattach??(i.onattach=[])}),Qi={number:"number",bigint:"bigint",object:"date"},vs=m("$ZodCheckLessThan",(e,t)=>{he.init(e,t);const i=Qi[typeof t.value];e._zod.onattach.push(n=>{const a=n._zod.bag,s=(t.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?a.maximum=t.value:a.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:i,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ws=m("$ZodCheckGreaterThan",(e,t)=>{he.init(e,t);const i=Qi[typeof t.value];e._zod.onattach.push(n=>{const a=n._zod.bag,s=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:i,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$s=m("$ZodCheckNumberFormat",(e,t)=>{he.init(e,t),t.format=t.format||"float64";const i=t.format?.includes("int"),n=i?"int":"number",[a,s]=Gn[t.format];e._zod.onattach.push(r=>{const l=r._zod.bag;l.format=t.format,l.minimum=a,l.maximum=s,i&&(l.pattern=ys)}),e._zod.check=r=>{const l=r.value;if(i){if(!Number.isInteger(l)){r.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?r.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):r.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}l<a&&r.issues.push({origin:"number",input:l,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),l>s&&r.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),ks=m("$ZodCheckMaxLength",(e,t)=>{var i;he.init(e,t),(i=e._zod.def).when??(i.when=n=>{const a=n.value;return!Yt(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const a=n.value;if(a.length<=t.maximum)return;const r=Qt(a);n.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),_s=m("$ZodCheckMinLength",(e,t)=>{var i;he.init(e,t),(i=e._zod.def).when??(i.when=n=>{const a=n.value;return!Yt(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const a=n.value;if(a.length>=t.minimum)return;const r=Qt(a);n.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),Cs=m("$ZodCheckLengthEquals",(e,t)=>{var i;he.init(e,t),(i=e._zod.def).when??(i.when=n=>{const a=n.value;return!Yt(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=n=>{const a=n.value,s=a.length;if(s===t.length)return;const r=Qt(a),l=s>t.length;n.issues.push({origin:r,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Mt=m("$ZodCheckStringFormat",(e,t)=>{var i,n;he.init(e,t),e._zod.onattach.push(a=>{const s=a._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(i=e._zod).check??(i.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Ss=m("$ZodCheckRegex",(e,t)=>{Mt.init(e,t),e._zod.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Os=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ds),Mt.init(e,t)}),xs=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=bs),Mt.init(e,t)}),Es=m("$ZodCheckIncludes",(e,t)=>{he.init(e,t);const i=Xt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${i}`:i);t.pattern=n,e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),Ps=m("$ZodCheckStartsWith",(e,t)=>{he.init(e,t);const i=new RegExp(`^${Xt(t.prefix)}.*`);t.pattern??(t.pattern=i),e._zod.onattach.push(n=>{const a=n._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(i)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Is=m("$ZodCheckEndsWith",(e,t)=>{he.init(e,t);const i=new RegExp(`.*${Xt(t.suffix)}$`);t.pattern??(t.pattern=i),e._zod.onattach.push(n=>{const a=n._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(i)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),As=m("$ZodCheckOverwrite",(e,t)=>{he.init(e,t),e._zod.check=i=>{i.value=t.tx(i.value)}}),Ts={major:4,minor:3,patch:6},F=m("$ZodType",(e,t)=>{var i;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ts;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const a of n)for(const s of a._zod.onattach)s(e);if(n.length===0)(i=e._zod).deferred??(i.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const a=(r,l,u)=>{let p=Ue(r),c;for(const h of l){if(h._zod.def.when){if(!h._zod.def.when(r))continue}else if(p)continue;const f=r.issues.length,g=h._zod.check(r);if(g instanceof Promise&&u?.async===!1)throw new Ve;if(c||g instanceof Promise)c=(c??Promise.resolve()).then(async()=>{await g,r.issues.length!==f&&(p||(p=Ue(r,f)))});else{if(r.issues.length===f)continue;p||(p=Ue(r,f))}}return c?c.then(()=>r):r},s=(r,l,u)=>{if(Ue(r))return r.aborted=!0,r;const p=a(l,n,u);if(p instanceof Promise){if(u.async===!1)throw new Ve;return p.then(c=>e._zod.parse(c,u))}return e._zod.parse(p,u)};e._zod.run=(r,l)=>{if(l.skipChecks)return e._zod.parse(r,l);if(l.direction==="backward"){const p=e._zod.parse({value:r.value,issues:[]},{...l,skipChecks:!0});return p instanceof Promise?p.then(c=>s(c,r,l)):s(p,r,l)}const u=e._zod.parse(r,l);if(u instanceof Promise){if(l.async===!1)throw new Ve;return u.then(p=>a(p,n,l))}return a(u,n,l)}}k(e,"~standard",()=>({validate:a=>{try{const s=Hi(e,a);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Yi(e,a).then(r=>r.success?{value:r.data}:{issues:r.error?.issues})}},vendor:"zod",version:1}))}),jt=m("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ms(e._zod.bag),e._zod.parse=(i,n)=>{if(t.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),ye=m("$ZodStringFormat",(e,t)=>{Mt.init(e,t),jt.init(e,t)}),Ls=m("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ki(n))}else t.pattern??(t.pattern=Ki());ye.init(e,t)}),Ms=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=os),ye.init(e,t)}),zs=m("$ZodURL",(e,t)=>{ye.init(e,t),e._zod.check=i=>{try{const n=i.value.trim(),a=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:i.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:i.value,inst:e,continue:!t.abort})),t.normalize?i.value=a.href:i.value=n;return}catch{i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!t.abort})}}}),Fs=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=hs(t)),ye.init(e,t)}),Rs=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ps),ye.init(e,t)}),Ns=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=cs(t)),ye.init(e,t)}),qs=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=rs),ye.init(e,t)}),Bs=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ls),ye.init(e,t),e._zod.bag.format="ipv4"}),Zs=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ds),ye.init(e,t),e._zod.bag.format="ipv6",e._zod.check=i=>{try{new URL(`http://[${i.value}]`)}catch{i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:e,continue:!t.abort})}}}),Vs=m("$ZodCustomStringFormat",(e,t)=>{ye.init(e,t),e._zod.check=i=>{t.fn(i.value)||i.issues.push({code:"invalid_format",format:t.format,input:i.value,inst:e,continue:!t.abort})}}),ji=m("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??fs,e._zod.parse=(i,n)=>{if(t.coerce)try{i.value=Number(i.value)}catch{}const a=i.value;if(typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a))return i;const s=typeof a=="number"?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return i.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...s?{received:s}:{}}),i}}),Us=m("$ZodNumberFormat",(e,t)=>{$s.init(e,t),ji.init(e,t)}),Ws=m("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=gs,e._zod.parse=(i,n)=>{if(t.coerce)try{i.value=!!i.value}catch{}const a=i.value;return typeof a=="boolean"||i.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),i}}),Gs=m("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=i=>i});function ea(e,t,i){e.issues.length&&t.issues.push(...Hn(i,e.issues)),t.value[i]=e.value}const ta=m("$ZodArray",(e,t)=>{F.init(e,t),e._zod.parse=(i,n)=>{const a=i.value;if(!Array.isArray(a))return i.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),i;i.value=Array(a.length);const s=[];for(let r=0;r<a.length;r++){const l=a[r],u=t.element._zod.run({value:l,issues:[]},n);u instanceof Promise?s.push(u.then(p=>ea(p,i,r))):ea(u,i,r)}return s.length?Promise.all(s).then(()=>i):i}});function ia(e,t,i,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const a=e.filter(s=>!Ue(s));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:i,errors:e.map(s=>s.issues.map(r=>Te(r,n,Ae())))}),t)}const Hs=m("$ZodUnion",(e,t)=>{F.init(e,t),k(e._zod,"optin",()=>t.options.some(a=>a._zod.optin==="optional")?"optional":void 0),k(e._zod,"optout",()=>t.options.some(a=>a._zod.optout==="optional")?"optional":void 0),k(e._zod,"values",()=>{if(t.options.every(a=>a._zod.values))return new Set(t.options.flatMap(a=>Array.from(a._zod.values)))}),k(e._zod,"pattern",()=>{if(t.options.every(a=>a._zod.pattern)){const a=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${a.map(s=>Kt(s.source)).join("|")})$`)}});const i=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(a,s)=>{if(i)return n(a,s);let r=!1;const l=[];for(const u of t.options){const p=u._zod.run({value:a.value,issues:[]},s);if(p instanceof Promise)l.push(p),r=!0;else{if(p.issues.length===0)return p;l.push(p)}}return r?Promise.all(l).then(u=>ia(u,a,e,s)):ia(l,a,e,s)}}),Ys=m("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(i,n)=>{const a=i.value,s=t.left._zod.run({value:a,issues:[]},n),r=t.right._zod.run({value:a,issues:[]},n);return s instanceof Promise||r instanceof Promise?Promise.all([s,r]).then(([u,p])=>aa(i,u,p)):aa(i,s,r)}});function ei(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Jt(e)&&Jt(t)){const i=Object.keys(t),n=Object.keys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(const s of n){const r=ei(e[s],t[s]);if(!r.valid)return{valid:!1,mergeErrorPath:[s,...r.mergeErrorPath]};a[s]=r.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const i=[];for(let n=0;n<e.length;n++){const a=e[n],s=t[n],r=ei(a,s);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i.push(r.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}function aa(e,t,i){const n=new Map;let a;for(const l of t.issues)if(l.code==="unrecognized_keys"){a??(a=l);for(const u of l.keys)n.has(u)||n.set(u,{}),n.get(u).l=!0}else e.issues.push(l);for(const l of i.issues)if(l.code==="unrecognized_keys")for(const u of l.keys)n.has(u)||n.set(u,{}),n.get(u).r=!0;else e.issues.push(l);const s=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&a&&e.issues.push({...a,keys:s}),Ue(e))return e;const r=ei(t.value,i.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const Ks=m("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.parse=(i,n)=>{if(n.direction==="backward")throw new Ni(e.constructor.name);const a=t.transform(i.value,i);if(n.async)return(a instanceof Promise?a:Promise.resolve(a)).then(r=>(i.value=r,i));if(a instanceof Promise)throw new Ve;return i.value=a,i}});function na(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const ti=m("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",k(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),k(e._zod,"pattern",()=>{const i=t.innerType._zod.pattern;return i?new RegExp(`^(${Kt(i.source)})?$`):void 0}),e._zod.parse=(i,n)=>{if(t.innerType._zod.optin==="optional"){const a=t.innerType._zod.run(i,n);return a instanceof Promise?a.then(s=>na(s,i.value)):na(a,i.value)}return i.value===void 0?i:t.innerType._zod.run(i,n)}}),Js=m("$ZodExactOptional",(e,t)=>{ti.init(e,t),k(e._zod,"values",()=>t.innerType._zod.values),k(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(i,n)=>t.innerType._zod.run(i,n)}),Xs=m("$ZodNullable",(e,t)=>{F.init(e,t),k(e._zod,"optin",()=>t.innerType._zod.optin),k(e._zod,"optout",()=>t.innerType._zod.optout),k(e._zod,"pattern",()=>{const i=t.innerType._zod.pattern;return i?new RegExp(`^(${Kt(i.source)}|null)$`):void 0}),k(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(i,n)=>i.value===null?i:t.innerType._zod.run(i,n)}),Qs=m("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",k(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(i,n)=>{if(n.direction==="backward")return t.innerType._zod.run(i,n);if(i.value===void 0)return i.value=t.defaultValue,i;const a=t.innerType._zod.run(i,n);return a instanceof Promise?a.then(s=>sa(s,t)):sa(a,t)}});function sa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const js=m("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",k(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(i,n)=>(n.direction==="backward"||i.value===void 0&&(i.value=t.defaultValue),t.innerType._zod.run(i,n))}),er=m("$ZodNonOptional",(e,t)=>{F.init(e,t),k(e._zod,"values",()=>{const i=t.innerType._zod.values;return i?new Set([...i].filter(n=>n!==void 0)):void 0}),e._zod.parse=(i,n)=>{const a=t.innerType._zod.run(i,n);return a instanceof Promise?a.then(s=>ra(s,e)):ra(a,e)}});function ra(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const tr=m("$ZodCatch",(e,t)=>{F.init(e,t),k(e._zod,"optin",()=>t.innerType._zod.optin),k(e._zod,"optout",()=>t.innerType._zod.optout),k(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(i,n)=>{if(n.direction==="backward")return t.innerType._zod.run(i,n);const a=t.innerType._zod.run(i,n);return a instanceof Promise?a.then(s=>(i.value=s.value,s.issues.length&&(i.value=t.catchValue({...i,error:{issues:s.issues.map(r=>Te(r,n,Ae()))},input:i.value}),i.issues=[]),i)):(i.value=a.value,a.issues.length&&(i.value=t.catchValue({...i,error:{issues:a.issues.map(s=>Te(s,n,Ae()))},input:i.value}),i.issues=[]),i)}}),ir=m("$ZodPipe",(e,t)=>{F.init(e,t),k(e._zod,"values",()=>t.in._zod.values),k(e._zod,"optin",()=>t.in._zod.optin),k(e._zod,"optout",()=>t.out._zod.optout),k(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(i,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(i,n);return s instanceof Promise?s.then(r=>zt(r,t.in,n)):zt(s,t.in,n)}const a=t.in._zod.run(i,n);return a instanceof Promise?a.then(s=>zt(s,t.out,n)):zt(a,t.out,n)}});function zt(e,t,i){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},i)}const ar=m("$ZodReadonly",(e,t)=>{F.init(e,t),k(e._zod,"propValues",()=>t.innerType._zod.propValues),k(e._zod,"values",()=>t.innerType._zod.values),k(e._zod,"optin",()=>t.innerType?._zod?.optin),k(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(i,n)=>{if(n.direction==="backward")return t.innerType._zod.run(i,n);const a=t.innerType._zod.run(i,n);return a instanceof Promise?a.then(oa):oa(a)}});function oa(e){return e.value=Object.freeze(e.value),e}const la=m("$ZodCustom",(e,t)=>{he.init(e,t),F.init(e,t),e._zod.parse=(i,n)=>i,e._zod.check=i=>{const n=i.value,a=t.fn(n);if(a instanceof Promise)return a.then(s=>da(s,i,n,e));da(a,i,n,e)}});function da(e,t,i,n){if(!e){const a={code:"custom",input:i,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(a.params=n._zod.def.params),t.issues.push(je(a))}}var ua;class nr{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...i){const n=i[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const i=this._map.get(t);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(t),this}get(t){const i=t._zod.parent;if(i){const n={...this.get(i)??{}};delete n.id;const a={...n,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function sr(){return new nr}(ua=globalThis).__zod_globalRegistry??(ua.__zod_globalRegistry=sr());const et=globalThis.__zod_globalRegistry;function rr(e,t){return new e({type:"string",...v(t)})}function or(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...v(t)})}function lr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...v(t)})}function dr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...v(t)})}function ur(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...v(t)})}function pr(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...v(t)})}function cr(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...v(t)})}function hr(e,t){return new e({type:"string",format:"date",check:"string_format",...v(t)})}function mr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...v(t)})}function yr(e,t){return new e({type:"string",format:"duration",check:"string_format",...v(t)})}function fr(e,t){return new e({type:"number",checks:[],...v(t)})}function gr(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...v(t)})}function Dr(e,t){return new e({type:"boolean",...v(t)})}function br(e){return new e({type:"any"})}function vr(e,t){return new vs({check:"less_than",...v(t),value:e,inclusive:!0})}function wr(e,t){return new ws({check:"greater_than",...v(t),value:e,inclusive:!0})}function Ft(e,t){return new ks({check:"max_length",...v(t),maximum:e})}function We(e,t){return new _s({check:"min_length",...v(t),minimum:e})}function pa(e,t){return new Cs({check:"length_equals",...v(t),length:e})}function ca(e,t){return new Ss({check:"string_format",format:"regex",...v(t),pattern:e})}function $r(e){return new Os({check:"string_format",format:"lowercase",...v(e)})}function kr(e){return new xs({check:"string_format",format:"uppercase",...v(e)})}function _r(e,t){return new Es({check:"string_format",format:"includes",...v(t),includes:e})}function Cr(e,t){return new Ps({check:"string_format",format:"starts_with",...v(t),prefix:e})}function Sr(e,t){return new Is({check:"string_format",format:"ends_with",...v(t),suffix:e})}function Ge(e){return new As({check:"overwrite",tx:e})}function Or(e){return Ge(t=>t.normalize(e))}function xr(){return Ge(e=>e.trim())}function Er(){return Ge(e=>e.toLowerCase())}function Pr(){return Ge(e=>e.toUpperCase())}function Ir(){return Ge(e=>Wn(e))}function Ar(e,t,i){return new e({type:"array",element:t,...v(i)})}function ha(e,t,i){return new e({type:"custom",check:"custom",fn:t,...v(i)})}function ma(e){const t=Tr(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(je(n,i.value,t._zod.def));else{const a=n;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=i.value),a.inst??(a.inst=t),a.continue??(a.continue=!t._zod.def.abort),i.issues.push(je(a))}},e(i.value,i)));return t}function Tr(e,t){const i=new he({check:"custom",...v(t)});return i._zod.check=e,i}function Lr(e,t,i,n={}){const a=v(n),s={...v(n),check:"string_format",type:"string",format:t,fn:typeof i=="function"?i:l=>i.test(l),...a};return i instanceof RegExp&&(s.pattern=i),new e(s)}function ya(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??et,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ie(e,t,i={path:[],schemaPath:[]}){var n;const a=e._zod.def,s=t.seen.get(e);if(s)return s.count++,i.schemaPath.includes(e)&&(s.cycle=i.path),s.schema;const r={schema:{},count:1,cycle:void 0,path:i.path};t.seen.set(e,r);const l=e._zod.toJSONSchema?.();if(l)r.schema=l;else{const c={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,r.schema,c);else{const f=r.schema,g=t.processors[a.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);g(e,t,f,c)}const h=e._zod.parent;h&&(r.ref||(r.ref=h),ie(h,t,c),t.seen.get(h).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(r.schema,u),t.io==="input"&&ae(e)&&(delete r.schema.examples,delete r.schema.default),t.io==="input"&&r.schema._prefault&&((n=r.schema).default??(n.default=r.schema._prefault)),delete r.schema._prefault,t.seen.get(e).schema}function fa(e,t){const i=e.seen.get(t);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const r of e.seen.entries()){const l=e.metadataRegistry.get(r[0])?.id;if(l){const u=n.get(l);if(u&&u!==r[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(l,r[0])}}const a=r=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(r[0])?.id,f=e.external.uri??(_=>_);if(h)return{ref:f(h)};const g=r[1].defId??r[1].schema.id??`schema${e.counter++}`;return r[1].defId=g,{defId:g,ref:`${f("__shared")}#/${l}/${g}`}}if(r[1]===i)return{ref:"#"};const p=`#/${l}/`,c=r[1].schema.id??`__schema${e.counter++}`;return{defId:c,ref:p+c}},s=r=>{if(r[1].schema.$ref)return;const l=r[1],{ref:u,defId:p}=a(r);l.def={...l.schema},p&&(l.defId=p);const c=l.schema;for(const h in c)delete c[h];c.$ref=u};if(e.cycles==="throw")for(const r of e.seen.entries()){const l=r[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
|
|
2
2
|
|
|
3
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const o=s[1];if(t===s[0]){n(s);continue}if(e.external){const h=e.external.registry.get(s[0])?.id;if(t!==s[0]&&h){n(s);continue}}if(e.metadataRegistry.get(s[0])?.id){n(s);continue}if(o.cycle){n(s);continue}if(o.count>1&&e.reused==="ref"){n(s);continue}}}function Xt(e,t){const a=e.seen.get(t);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=s=>{const o=e.seen.get(s);if(o.ref===null)return;const u=o.def??o.schema,h={...u},f=o.ref;if(o.ref=null,f){r(f);const v=e.seen.get(f),$=v.schema;if($.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push($)):Object.assign(u,$),Object.assign(u,h),s._zod.parent===f)for(const k in u)k==="$ref"||k==="allOf"||k in h||delete u[k];if($.$ref&&v.def)for(const k in u)k==="$ref"||k==="allOf"||k in v.def&&JSON.stringify(u[k])===JSON.stringify(v.def[k])&&delete u[k]}const g=s._zod.parent;if(g&&g!==f){r(g);const v=e.seen.get(g);if(v?.schema.$ref&&(u.$ref=v.schema.$ref,v.def))for(const $ in u)$==="$ref"||$==="allOf"||$ in v.def&&JSON.stringify(u[$])===JSON.stringify(v.def[$])&&delete u[$]}e.override({zodSchema:s,jsonSchema:u,path:o.path??[]})};for(const s of[...e.seen.entries()].reverse())r(s[0]);const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(s)}Object.assign(i,a.def??a.schema);const n=e.external?.defs??{};for(const s of e.seen.entries()){const o=s[1];o.def&&o.defId&&(n[o.defId]=o.def)}e.external||Object.keys(n).length>0&&(e.target==="draft-2020-12"?i.$defs=n:i.definitions=n);try{const s=JSON.parse(JSON.stringify(i));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:Re(t,"input",e.processors),output:Re(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function O(e,t){const a=t??{seen:new Set};if(a.seen.has(e))return!1;a.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return O(r.element,a);if(r.type==="set")return O(r.valueType,a);if(r.type==="lazy")return O(r.getter(),a);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return O(r.innerType,a);if(r.type==="intersection")return O(r.left,a)||O(r.right,a);if(r.type==="record"||r.type==="map")return O(r.keyType,a)||O(r.valueType,a);if(r.type==="pipe")return O(r.in,a)||O(r.out,a);if(r.type==="object"){for(const i in r.shape)if(O(r.shape[i],a))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(O(i,a))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(O(i,a))return!0;return!!(r.rest&&O(r.rest,a))}return!1}const ni=(e,t={})=>a=>{const r=Ht({...a,processors:t});return x(e,r),Yt(r,e),Xt(r,e)},Re=(e,t,a={})=>r=>{const{libraryOptions:i,target:n}=r??{},s=Ht({...i??{},target:n,io:t,processors:a});return x(e,s),Yt(s,e),Xt(s,e)},si={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oi=(e,t,a,r)=>{const i=a;i.type="string";const{minimum:n,maximum:s,format:o,patterns:u,contentEncoding:h}=e._zod.bag;if(typeof n=="number"&&(i.minLength=n),typeof s=="number"&&(i.maxLength=s),o&&(i.format=si[o]??o,i.format===""&&delete i.format,o==="time"&&delete i.format),h&&(i.contentEncoding=h),u&&u.size>0){const f=[...u];f.length===1?i.pattern=f[0].source:f.length>1&&(i.allOf=[...f.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},ui=(e,t,a,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},li=(e,t,a,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},di=(e,t,a,r)=>{const i=a,n=e._zod.def,{minimum:s,maximum:o}=e._zod.bag;typeof s=="number"&&(i.minItems=s),typeof o=="number"&&(i.maxItems=o),i.type="array",i.items=x(n.element,t,{...r,path:[...r.path,"items"]})},ci=(e,t,a,r)=>{const i=e._zod.def,n=i.inclusive===!1,s=i.options.map((o,u)=>x(o,t,{...r,path:[...r.path,n?"oneOf":"anyOf",u]}));n?a.oneOf=s:a.anyOf=s},pi=(e,t,a,r)=>{const i=e._zod.def,n=x(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=x(i.right,t,{...r,path:[...r.path,"allOf",1]}),o=h=>"allOf"in h&&Object.keys(h).length===1,u=[...o(n)?n.allOf:[n],...o(s)?s.allOf:[s]];a.allOf=u},hi=(e,t,a,r)=>{const i=e._zod.def,n=x(i.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=i.innerType,a.nullable=!0):a.anyOf=[n,{type:"null"}]},mi=(e,t,a,r)=>{const i=e._zod.def;x(i.innerType,t,r);const n=t.seen.get(e);n.ref=i.innerType},fi=(e,t,a,r)=>{const i=e._zod.def;x(i.innerType,t,r);const n=t.seen.get(e);n.ref=i.innerType,a.default=JSON.parse(JSON.stringify(i.defaultValue))},gi=(e,t,a,r)=>{const i=e._zod.def;x(i.innerType,t,r);const n=t.seen.get(e);n.ref=i.innerType,t.io==="input"&&(a._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},bi=(e,t,a,r)=>{const i=e._zod.def;x(i.innerType,t,r);const n=t.seen.get(e);n.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}a.default=s},vi=(e,t,a,r)=>{const i=e._zod.def,n=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;x(n,t,r);const s=t.seen.get(e);s.ref=n},_i=(e,t,a,r)=>{const i=e._zod.def;x(i.innerType,t,r);const n=t.seen.get(e);n.ref=i.innerType,a.readOnly=!0},Qt=(e,t,a,r)=>{const i=e._zod.def;x(i.innerType,t,r);const n=t.seen.get(e);n.ref=i.innerType},$i=c("ZodISODateTime",(e,t)=>{or.init(e,t),Ae.init(e,t)});function yi(e){return Rr($i,e)}const wi=c("ZodISODate",(e,t)=>{ur.init(e,t),Ae.init(e,t)});function Di(e){return Ar(wi,e)}const Ci=c("ZodISOTime",(e,t)=>{lr.init(e,t),Ae.init(e,t)});function xi(e){return Fr(Ci,e)}const Oi=c("ZodISODuration",(e,t)=>{dr.init(e,t),Ae.init(e,t)});function Pi(e){return Mr(Oi,e)}const T=c("ZodError",(e,t)=>{Pt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:a=>_a(e,a)},flatten:{value:a=>va(e,a)},addIssue:{value:a=>{e.issues.push(a),e.message=JSON.stringify(e.issues,Me,2)}},addIssues:{value:a=>{e.issues.push(...a),e.message=JSON.stringify(e.issues,Me,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),zi=Ee(T),Ei=Ie(T),Ii=ke(T),ki=Se(T),Si=wa(T),Ti=Da(T),Zi=Ca(T),Li=xa(T),Ri=Oa(T),Ai=Pa(T),Fi=za(T),Mi=Ea(T),P=c("ZodType",(e,t)=>(D.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Re(e,"input"),output:Re(e,"output")}}),e.toJSONSchema=ni(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...a)=>e.clone(ma(t,{checks:[...t.checks??[],...a.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(a,r)=>xt(e,a,r),e.brand=()=>e,e.register=((a,r)=>(a.add(e,r),e)),e.parse=(a,r)=>zi(e,a,r,{callee:e.parse}),e.safeParse=(a,r)=>Ii(e,a,r),e.parseAsync=async(a,r)=>Ei(e,a,r,{callee:e.parseAsync}),e.safeParseAsync=async(a,r)=>ki(e,a,r),e.spa=e.safeParseAsync,e.encode=(a,r)=>Si(e,a,r),e.decode=(a,r)=>Ti(e,a,r),e.encodeAsync=async(a,r)=>Zi(e,a,r),e.decodeAsync=async(a,r)=>Li(e,a,r),e.safeEncode=(a,r)=>Ri(e,a,r),e.safeDecode=(a,r)=>Ai(e,a,r),e.safeEncodeAsync=async(a,r)=>Fi(e,a,r),e.safeDecodeAsync=async(a,r)=>Mi(e,a,r),e.refine=(a,r)=>e.check(pn(a,r)),e.superRefine=a=>e.check(hn(a)),e.overwrite=a=>e.check(Y(a)),e.optional=()=>ea(e),e.exactOptional=()=>Yi(e),e.nullable=()=>ta(e),e.nullish=()=>ea(ta(e)),e.nonoptional=a=>nn(e,a),e.array=()=>Ni(e),e.or=a=>Vi([e,a]),e.and=a=>Wi(e,a),e.transform=a=>aa(e,Gi(a)),e.default=a=>en(e,a),e.prefault=a=>an(e,a),e.catch=a=>on(e,a),e.pipe=a=>aa(e,a),e.readonly=()=>dn(e),e.describe=a=>{const r=e.clone();return re.add(r,{description:a}),r},Object.defineProperty(e,"description",{get(){return re.get(e)?.description},configurable:!0}),e.meta=(...a)=>{if(a.length===0)return re.get(e);const r=e.clone();return re.add(r,a[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=a=>a(e),e)),ji=c("_ZodString",(e,t)=>{Be.init(e,t),P.init(e,t),e._zod.processJSONSchema=(r,i,n)=>oi(e,r,i);const a=e._zod.bag;e.format=a.format??null,e.minLength=a.minimum??null,e.maxLength=a.maximum??null,e.regex=(...r)=>e.check(Jt(...r)),e.includes=(...r)=>e.check(Gr(...r)),e.startsWith=(...r)=>e.check(Kr(...r)),e.endsWith=(...r)=>e.check(Hr(...r)),e.min=(...r)=>e.check(H(...r)),e.max=(...r)=>e.check(Le(...r)),e.length=(...r)=>e.check(Wt(...r)),e.nonempty=(...r)=>e.check(H(1,...r)),e.lowercase=r=>e.check(Wr(r)),e.uppercase=r=>e.check(Jr(r)),e.trim=()=>e.check(Xr()),e.normalize=(...r)=>e.check(Yr(...r)),e.toLowerCase=()=>e.check(Qr()),e.toUpperCase=()=>e.check(ei()),e.slugify=()=>e.check(ti())}),Ae=c("ZodStringFormat",(e,t)=>{S.init(e,t),ji.init(e,t)}),qi=c("ZodArray",(e,t)=>{Rt.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>di(e,a,r,i),e.element=t.element,e.min=(a,r)=>e.check(H(a,r)),e.nonempty=a=>e.check(H(1,a)),e.max=(a,r)=>e.check(Le(a,r)),e.length=(a,r)=>e.check(Wt(a,r)),e.unwrap=()=>e.element});function Ni(e,t){return ai(qi,e,t)}const Ui=c("ZodUnion",(e,t)=>{br.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>ci(e,a,r,i),e.options=t.options});function Vi(e,t){return new Ui({type:"union",options:e,...b(t)})}const Bi=c("ZodIntersection",(e,t)=>{vr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>pi(e,a,r,i)});function Wi(e,t){return new Bi({type:"intersection",left:e,right:t})}const Ji=c("ZodTransform",(e,t)=>{_r.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>li(e,a),e._zod.parse=(a,r)=>{if(r.direction==="backward")throw new $t(e.constructor.name);a.addIssue=n=>{if(typeof n=="string")a.issues.push(ae(n,a.value,t));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=a.value),s.inst??(s.inst=e),a.issues.push(ae(s))}};const i=t.transform(a.value,a);return i instanceof Promise?i.then(n=>(a.value=n,a)):(a.value=i,a)}});function Gi(e){return new Ji({type:"transform",transform:e})}const Ki=c("ZodOptional",(e,t)=>{Je.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>Qt(e,a,r,i),e.unwrap=()=>e._zod.def.innerType});function ea(e){return new Ki({type:"optional",innerType:e})}const Hi=c("ZodExactOptional",(e,t)=>{$r.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>Qt(e,a,r,i),e.unwrap=()=>e._zod.def.innerType});function Yi(e){return new Hi({type:"optional",innerType:e})}const Xi=c("ZodNullable",(e,t)=>{yr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>hi(e,a,r,i),e.unwrap=()=>e._zod.def.innerType});function ta(e){return new Xi({type:"nullable",innerType:e})}const Qi=c("ZodDefault",(e,t)=>{wr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>fi(e,a,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function en(e,t){return new Qi({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ct(t)}})}const tn=c("ZodPrefault",(e,t)=>{Dr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>gi(e,a,r,i),e.unwrap=()=>e._zod.def.innerType});function an(e,t){return new tn({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ct(t)}})}const rn=c("ZodNonOptional",(e,t)=>{Cr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>mi(e,a,r,i),e.unwrap=()=>e._zod.def.innerType});function nn(e,t){return new rn({type:"nonoptional",innerType:e,...b(t)})}const sn=c("ZodCatch",(e,t)=>{xr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>bi(e,a,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function on(e,t){return new sn({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const un=c("ZodPipe",(e,t)=>{Or.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>vi(e,a,r,i),e.in=t.in,e.out=t.out});function aa(e,t){return new un({type:"pipe",in:e,out:t})}const ln=c("ZodReadonly",(e,t)=>{Pr.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>_i(e,a,r,i),e.unwrap=()=>e._zod.def.innerType});function dn(e){return new ln({type:"readonly",innerType:e})}const cn=c("ZodCustom",(e,t)=>{Ut.init(e,t),P.init(e,t),e._zod.processJSONSchema=(a,r,i)=>ui(e,a)});function pn(e,t={}){return Gt(cn,e,t)}function hn(e){return Kt(e)}const U=c("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");D.init(e,t),e.def=t,e.type=t.type,e.parse=(a,r)=>$a(e,a,r,{callee:e.parse}),e.safeParse=(a,r)=>zt(e,a,r),e.parseAsync=async(a,r)=>ya(e,a,r,{callee:e.parseAsync}),e.safeParseAsync=async(a,r)=>Et(e,a,r),e.check=(...a)=>e.clone({...t,checks:[...t.checks??[],...a.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0}),e.with=e.check,e.clone=(a,r)=>xt(e,a,r),e.brand=()=>e,e.register=((a,r)=>(a.add(e,r),e)),e.apply=a=>a(e)}),ra=c("ZodMiniString",(e,t)=>{Be.init(e,t),U.init(e,t)});function ia(e){return Ir(ra,e)}const X=c("ZodMiniStringFormat",(e,t)=>{S.init(e,t),ra.init(e,t)}),mn=c("ZodMiniEmail",(e,t)=>{nr.init(e,t),X.init(e,t)});function fn(e){return kr(mn,e)}const gn=c("ZodMiniUUID",(e,t)=>{ir.init(e,t),X.init(e,t)});function bn(e){return Sr(gn,e)}const vn=c("ZodMiniURL",(e,t)=>{sr.init(e,t),X.init(e,t)});function _n(e){return Tr(vn,e)}const $n=c("ZodMiniIPv4",(e,t)=>{cr.init(e,t),X.init(e,t)});function yn(e){return Zr($n,e)}const wn=c("ZodMiniIPv6",(e,t)=>{pr.init(e,t),X.init(e,t)});function Dn(e){return Lr(wn,e)}const Cn=c("ZodMiniCustomStringFormat",(e,t)=>{hr.init(e,t),X.init(e,t)});function xn(e){return ii(Cn,"hostname",Za,e)}const na=c("ZodMiniNumber",(e,t)=>{Zt.init(e,t),U.init(e,t)});function sa(e){return jr(na,e)}const On=c("ZodMiniNumberFormat",(e,t)=>{mr.init(e,t),na.init(e,t)});function Pn(e){return qr(On,e)}const zn=c("ZodMiniBoolean",(e,t)=>{fr.init(e,t),U.init(e,t)});function oa(e){return Nr(zn,e)}const En=c("ZodMiniAny",(e,t)=>{gr.init(e,t),U.init(e,t)});function Ge(){return Ur(En)}const In=c("ZodMiniArray",(e,t)=>{Rt.init(e,t),U.init(e,t)});function ua(e,t){return new In({type:"array",element:e,...b(t)})}const kn=c("ZodMiniOptional",(e,t)=>{Je.init(e,t),U.init(e,t)});function Sn(e){return new kn({type:"optional",innerType:e})}const Tn=c("ZodMiniCustom",(e,t)=>{Ut.init(e,t),U.init(e,t)});function C(e,t={}){return Gt(Tn,e,t)}function la(e){return Kt(e)}const Ke={email:{schema:fn()},hostname:{schema:xn()},ipv4:{schema:yn()},ipv6:{schema:Dn()},url:{schema:_n()},uuid:{schema:bn()},date:{schema:Di()},time:{schema:xi()},"date-time":{schema:yi()},duration:{schema:Pi()}},Zn=Object.keys(Ke),Ln=e=>(t,a)=>{switch(t.type){case"string":return Rn(t,a);case"integer":case"number":return Fn(t,a);case"boolean":return Mn(t,a);case"array":return jn(t,a);case"custom":{if(!e)throw new Error('Validator type "custom" requires a customValidators object, but it was not supplied.');return qn(t,e)}}};function w(e,t){if(e!==void 0)return typeof e=="string"?e:t?.translate(e.key,e.params,e.default)??e.default}function Rn(e,t){return ie(e,a=>{const r=w(a.messages?.invalid,t);let i=r?ia(r):ia();if(a.required===!0){const n=w(a.messages?.required,t)??"This field is required";i=i.check(C(s=>s.length>0,{error:n}))}if(typeof a.minLength=="number"){const n=w(a.messages?.minLength,t),s=a.minLength;i=i.check(n?C(o=>o.length>=s,{error:n}):H(s))}if(typeof a.maxLength=="number"){const n=w(a.messages?.maxLength,t),s=a.maxLength;i=i.check(n?C(o=>o.length<=s,{error:n}):Le(s))}if(typeof a.pattern=="string"){const n=w(a.messages?.pattern,t),s=new RegExp(a.pattern);i=i.check(n?C(o=>s.test(o),{error:n}):Jt(s))}if(a.enum){const n=a.enum,s=w(a.messages?.enum,t);i=i.check(C(o=>n.includes(o),s?{error:s}:void 0))}if(a.const!==void 0){const n=w(a.messages?.const,t);i=i.check(C(s=>s===a.const,n?{error:n}:void 0))}if(a.format!==void 0)if(Zn.includes(a.format)){const n=w(a.messages?.format,t);i=i.check(n?la((s,o)=>{const u=te.standardValidate(Ke[a.format].schema,s);te.isStandardValidateSuccess(u)||o.addIssue({code:"custom",path:[],message:n})}):Ke[a.format].schema)}else console.error(`The string validation format "${a.format}" is not supported`);return i})}const An=(e,t)=>{if(t===0)return!1;const a=e/t;return Math.abs(a-Math.round(a))<1e-10};function Fn(e,t){return ie(e,a=>{const r=w(a.messages?.invalid,t);let i=r?sa(r):sa();if(a.type==="integer"&&(i=i.check(Pn())),a.minimum!==void 0){const n=w(a.messages?.minimum,t),s=a.minimum;i=i.check(n?C(o=>o>=s,{error:n}):Br(s))}if(a.maximum!==void 0){const n=w(a.messages?.maximum,t),s=a.maximum;i=i.check(n?C(o=>o<=s,{error:n}):Vr(s))}if(a.exclusiveMinimum!==void 0){const n=w(a.messages?.exclusiveMinimum,t),s=a.exclusiveMinimum;i=i.check(C(o=>o>s,n?{error:n}:void 0))}if(a.exclusiveMaximum!==void 0){const n=w(a.messages?.exclusiveMaximum,t),s=a.exclusiveMaximum;i=i.check(C(o=>o<s,n?{error:n}:void 0))}if(a.multipleOf!==void 0){const n=w(a.messages?.multipleOf,t),s=a.multipleOf;i=i.check(C(o=>An(o,s),n?{error:n}:void 0))}if(a.enum){const n=a.enum,s=w(a.messages?.enum,t);i=i.check(C(o=>n.includes(o),s?{error:s}:void 0))}if(a.const!==void 0){const n=w(a.messages?.const,t);i=i.check(C(s=>s===a.const,n?{error:n}:void 0))}return i})}function Mn(e,t){return ie(e,a=>{const r=w(a.messages?.invalid,t);let i=r?oa(r):oa();if(a.const!==void 0){const n=w(a.messages?.const,t);i=i.check(C(s=>s===a.const,n?{error:n}:void 0))}return i})}function jn(e,t){return ie(e,a=>{const r=w(a.messages?.invalid,t);let i=r?ua(Ge(),r):ua(Ge());if(a.required===!0){const n=w(a.messages?.required,t)??"This field is required";i=i.check(C(s=>s.length>0,{error:n}))}if(typeof a.minItems=="number"){const n=w(a.messages?.minItems,t),s=a.minItems;i=i.check(n?C(o=>o.length>=s,{error:n}):H(s))}if(typeof a.maxItems=="number"){const n=w(a.messages?.maxItems,t),s=a.maxItems;i=i.check(n?C(o=>o.length<=s,{error:n}):Le(s))}return i})}function qn(e,t){return ie(e,a=>{let r=Ge();return te.filterTap(Object.keys(a),i=>i!=="type"&&i!=="required",i=>{const n=a[i],s=t[i],o=s(n);r=r.check(la((u,h)=>{const f=te.standardValidate(o,u);if(!te.isStandardValidateSuccess(f)){const g=f.issues[0];h.addIssue({code:"custom",path:[],message:g?.message||`Validation failed for ${i}`})}}))}),r})}function ie(e,t){const a=t(e);return e.required?a:Sn(a)}var Nn=Object.defineProperty,Un=Object.getOwnPropertyDescriptor,Fe=(e,t,a,r)=>{for(var i=r>1?void 0:r?Un(t,a):t,n=e.length-1,s;n>=0;n--)(s=e[n])&&(i=(r?s(t,a,i):s(i))||i);return r&&i&&Nn(t,a,i),i};y.FormElement=class extends l.LitElement{constructor(){super(...arguments),this.autocomplete=void 0}setData(t){this.coreForm?.setData(t)}setMeta(t){this.coreForm?.setMeta(t)}createRenderRoot(){return this}render(){const t=this.config,a=bt.resolveFormInput(t.formDef,t.formSelectors,t.formConfig),r={formDef:a.formDef,widgetLoaders:{..._t,...a.widgetLoaders,...t.customWidgetLoaders??{}},dependencies:{...a.dependencies??{},...t.dependencies??{}},validateOn:t.validateOn??a.validateOn??"eager",itemRenderers:{...a.itemRenderers??{},...t.itemRenderers??{}},localization:t.localization,middlewares:t.middlewares??[],data:t.data,meta:t.meta,formName:t.formName},i=Ln({...t.customValidators??{}}),n=a.formEvent,s=n?o=>n(o.detail):void 0;return l.html`
|
|
3
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const l=r[1];if(t===r[0]){s(r);continue}if(e.external){const p=e.external.registry.get(r[0])?.id;if(t!==r[0]&&p){s(r);continue}}if(e.metadataRegistry.get(r[0])?.id){s(r);continue}if(l.cycle){s(r);continue}if(l.count>1&&e.reused==="ref"){s(r);continue}}}function ga(e,t){const i=e.seen.get(t);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=r=>{const l=e.seen.get(r);if(l.ref===null)return;const u=l.def??l.schema,p={...u},c=l.ref;if(l.ref=null,c){n(c);const f=e.seen.get(c),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Object.assign(u,g),Object.assign(u,p),r._zod.parent===c)for(const T in u)T==="$ref"||T==="allOf"||T in p||delete u[T];if(g.$ref&&f.def)for(const T in u)T==="$ref"||T==="allOf"||T in f.def&&JSON.stringify(u[T])===JSON.stringify(f.def[T])&&delete u[T]}const h=r._zod.parent;if(h&&h!==c){n(h);const f=e.seen.get(h);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(const g in u)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g])&&delete u[g]}e.override({zodSchema:r,jsonSchema:u,path:l.path??[]})};for(const r of[...e.seen.entries()].reverse())n(r[0]);const a={};if(e.target==="draft-2020-12"?a.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?a.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(r)}Object.assign(a,i.def??i.schema);const s=e.external?.defs??{};for(const r of e.seen.entries()){const l=r[1];l.def&&l.defId&&(s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?a.$defs=s:a.definitions=s);try{const r=JSON.parse(JSON.stringify(a));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:Rt(t,"input",e.processors),output:Rt(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch{throw new Error("Error converting schema to JSON.")}}function ae(e,t){const i=t??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ae(n.element,i);if(n.type==="set")return ae(n.valueType,i);if(n.type==="lazy")return ae(n.getter(),i);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return ae(n.innerType,i);if(n.type==="intersection")return ae(n.left,i)||ae(n.right,i);if(n.type==="record"||n.type==="map")return ae(n.keyType,i)||ae(n.valueType,i);if(n.type==="pipe")return ae(n.in,i)||ae(n.out,i);if(n.type==="object"){for(const a in n.shape)if(ae(n.shape[a],i))return!0;return!1}if(n.type==="union"){for(const a of n.options)if(ae(a,i))return!0;return!1}if(n.type==="tuple"){for(const a of n.items)if(ae(a,i))return!0;return!!(n.rest&&ae(n.rest,i))}return!1}const Mr=(e,t={})=>i=>{const n=ya({...i,processors:t});return ie(e,n),fa(n,e),ga(n,e)},Rt=(e,t,i={})=>n=>{const{libraryOptions:a,target:s}=n??{},r=ya({...a??{},target:s,io:t,processors:i});return ie(e,r),fa(r,e),ga(r,e)},zr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Fr=(e,t,i,n)=>{const a=i;a.type="string";const{minimum:s,maximum:r,format:l,patterns:u,contentEncoding:p}=e._zod.bag;if(typeof s=="number"&&(a.minLength=s),typeof r=="number"&&(a.maxLength=r),l&&(a.format=zr[l]??l,a.format===""&&delete a.format,l==="time"&&delete a.format),p&&(a.contentEncoding=p),u&&u.size>0){const c=[...u];c.length===1?a.pattern=c[0].source:c.length>1&&(a.allOf=[...c.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},Rr=(e,t,i,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Nr=(e,t,i,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},qr=(e,t,i,n)=>{const a=i,s=e._zod.def,{minimum:r,maximum:l}=e._zod.bag;typeof r=="number"&&(a.minItems=r),typeof l=="number"&&(a.maxItems=l),a.type="array",a.items=ie(s.element,t,{...n,path:[...n.path,"items"]})},Br=(e,t,i,n)=>{const a=e._zod.def,s=a.inclusive===!1,r=a.options.map((l,u)=>ie(l,t,{...n,path:[...n.path,s?"oneOf":"anyOf",u]}));s?i.oneOf=r:i.anyOf=r},Zr=(e,t,i,n)=>{const a=e._zod.def,s=ie(a.left,t,{...n,path:[...n.path,"allOf",0]}),r=ie(a.right,t,{...n,path:[...n.path,"allOf",1]}),l=p=>"allOf"in p&&Object.keys(p).length===1,u=[...l(s)?s.allOf:[s],...l(r)?r.allOf:[r]];i.allOf=u},Vr=(e,t,i,n)=>{const a=e._zod.def,s=ie(a.innerType,t,n),r=t.seen.get(e);t.target==="openapi-3.0"?(r.ref=a.innerType,i.nullable=!0):i.anyOf=[s,{type:"null"}]},Ur=(e,t,i,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType},Wr=(e,t,i,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType,i.default=JSON.parse(JSON.stringify(a.defaultValue))},Gr=(e,t,i,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType,t.io==="input"&&(i._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},Hr=(e,t,i,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType;let r;try{r=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=r},Yr=(e,t,i,n)=>{const a=e._zod.def,s=t.io==="input"?a.in._zod.def.type==="transform"?a.out:a.in:a.out;ie(s,t,n);const r=t.seen.get(e);r.ref=s},Kr=(e,t,i,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType,i.readOnly=!0},Da=(e,t,i,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType},Jr=m("ZodISODateTime",(e,t)=>{Fs.init(e,t),Nt.init(e,t)});function Xr(e){return cr(Jr,e)}const Qr=m("ZodISODate",(e,t)=>{Rs.init(e,t),Nt.init(e,t)});function jr(e){return hr(Qr,e)}const eo=m("ZodISOTime",(e,t)=>{Ns.init(e,t),Nt.init(e,t)});function to(e){return mr(eo,e)}const io=m("ZodISODuration",(e,t)=>{qs.init(e,t),Nt.init(e,t)});function ao(e){return yr(io,e)}const fe=m("ZodError",(e,t)=>{Gi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:i=>Kn(e,i)},flatten:{value:i=>Yn(e,i)},addIssue:{value:i=>{e.issues.push(i),e.message=JSON.stringify(e.issues,Ht,2)}},addIssues:{value:i=>{e.issues.push(...i),e.message=JSON.stringify(e.issues,Ht,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),no=It(fe),so=At(fe),ro=Tt(fe),oo=Lt(fe),lo=Qn(fe),uo=jn(fe),po=es(fe),co=ts(fe),ho=is(fe),mo=as(fe),yo=ns(fe),fo=ss(fe),ne=m("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Rt(e,"input"),output:Rt(e,"output")}}),e.toJSONSchema=Mr(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...i)=>e.clone(Un(t,{checks:[...t.checks??[],...i.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(i,n)=>Ui(e,i,n),e.brand=()=>e,e.register=((i,n)=>(i.add(e,n),e)),e.parse=(i,n)=>no(e,i,n,{callee:e.parse}),e.safeParse=(i,n)=>ro(e,i,n),e.parseAsync=async(i,n)=>so(e,i,n,{callee:e.parseAsync}),e.safeParseAsync=async(i,n)=>oo(e,i,n),e.spa=e.safeParseAsync,e.encode=(i,n)=>lo(e,i,n),e.decode=(i,n)=>uo(e,i,n),e.encodeAsync=async(i,n)=>po(e,i,n),e.decodeAsync=async(i,n)=>co(e,i,n),e.safeEncode=(i,n)=>ho(e,i,n),e.safeDecode=(i,n)=>mo(e,i,n),e.safeEncodeAsync=async(i,n)=>yo(e,i,n),e.safeDecodeAsync=async(i,n)=>fo(e,i,n),e.refine=(i,n)=>e.check(Zo(i,n)),e.superRefine=i=>e.check(Vo(i)),e.overwrite=i=>e.check(Ge(i)),e.optional=()=>ba(e),e.exactOptional=()=>xo(e),e.nullable=()=>va(e),e.nullish=()=>ba(va(e)),e.nonoptional=i=>Mo(e,i),e.array=()=>bo(e),e.or=i=>wo([e,i]),e.and=i=>ko(e,i),e.transform=i=>wa(e,Co(i)),e.default=i=>Io(e,i),e.prefault=i=>To(e,i),e.catch=i=>Fo(e,i),e.pipe=i=>wa(e,i),e.readonly=()=>qo(e),e.describe=i=>{const n=e.clone();return et.add(n,{description:i}),n},Object.defineProperty(e,"description",{get(){return et.get(e)?.description},configurable:!0}),e.meta=(...i)=>{if(i.length===0)return et.get(e);const n=e.clone();return et.add(n,i[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=i=>i(e),e)),go=m("_ZodString",(e,t)=>{jt.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,a,s)=>Fr(e,n,a);const i=e._zod.bag;e.format=i.format??null,e.minLength=i.minimum??null,e.maxLength=i.maximum??null,e.regex=(...n)=>e.check(ca(...n)),e.includes=(...n)=>e.check(_r(...n)),e.startsWith=(...n)=>e.check(Cr(...n)),e.endsWith=(...n)=>e.check(Sr(...n)),e.min=(...n)=>e.check(We(...n)),e.max=(...n)=>e.check(Ft(...n)),e.length=(...n)=>e.check(pa(...n)),e.nonempty=(...n)=>e.check(We(1,...n)),e.lowercase=n=>e.check($r(n)),e.uppercase=n=>e.check(kr(n)),e.trim=()=>e.check(xr()),e.normalize=(...n)=>e.check(Or(...n)),e.toLowerCase=()=>e.check(Er()),e.toUpperCase=()=>e.check(Pr()),e.slugify=()=>e.check(Ir())}),Nt=m("ZodStringFormat",(e,t)=>{ye.init(e,t),go.init(e,t)}),Do=m("ZodArray",(e,t)=>{ta.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>qr(e,i,n,a),e.element=t.element,e.min=(i,n)=>e.check(We(i,n)),e.nonempty=i=>e.check(We(1,i)),e.max=(i,n)=>e.check(Ft(i,n)),e.length=(i,n)=>e.check(pa(i,n)),e.unwrap=()=>e.element});function bo(e,t){return Ar(Do,e,t)}const vo=m("ZodUnion",(e,t)=>{Hs.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Br(e,i,n,a),e.options=t.options});function wo(e,t){return new vo({type:"union",options:e,...v(t)})}const $o=m("ZodIntersection",(e,t)=>{Ys.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Zr(e,i,n,a)});function ko(e,t){return new $o({type:"intersection",left:e,right:t})}const _o=m("ZodTransform",(e,t)=>{Ks.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Nr(e,i),e._zod.parse=(i,n)=>{if(n.direction==="backward")throw new Ni(e.constructor.name);i.addIssue=s=>{if(typeof s=="string")i.issues.push(je(s,i.value,t));else{const r=s;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=i.value),r.inst??(r.inst=e),i.issues.push(je(r))}};const a=t.transform(i.value,i);return a instanceof Promise?a.then(s=>(i.value=s,i)):(i.value=a,i)}});function Co(e){return new _o({type:"transform",transform:e})}const So=m("ZodOptional",(e,t)=>{ti.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Da(e,i,n,a),e.unwrap=()=>e._zod.def.innerType});function ba(e){return new So({type:"optional",innerType:e})}const Oo=m("ZodExactOptional",(e,t)=>{Js.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Da(e,i,n,a),e.unwrap=()=>e._zod.def.innerType});function xo(e){return new Oo({type:"optional",innerType:e})}const Eo=m("ZodNullable",(e,t)=>{Xs.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Vr(e,i,n,a),e.unwrap=()=>e._zod.def.innerType});function va(e){return new Eo({type:"nullable",innerType:e})}const Po=m("ZodDefault",(e,t)=>{Qs.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Wr(e,i,n,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Io(e,t){return new Po({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Vi(t)}})}const Ao=m("ZodPrefault",(e,t)=>{js.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Gr(e,i,n,a),e.unwrap=()=>e._zod.def.innerType});function To(e,t){return new Ao({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Vi(t)}})}const Lo=m("ZodNonOptional",(e,t)=>{er.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Ur(e,i,n,a),e.unwrap=()=>e._zod.def.innerType});function Mo(e,t){return new Lo({type:"nonoptional",innerType:e,...v(t)})}const zo=m("ZodCatch",(e,t)=>{tr.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Hr(e,i,n,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fo(e,t){return new zo({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ro=m("ZodPipe",(e,t)=>{ir.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Yr(e,i,n,a),e.in=t.in,e.out=t.out});function wa(e,t){return new Ro({type:"pipe",in:e,out:t})}const No=m("ZodReadonly",(e,t)=>{ar.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Kr(e,i,n,a),e.unwrap=()=>e._zod.def.innerType});function qo(e){return new No({type:"readonly",innerType:e})}const Bo=m("ZodCustom",(e,t)=>{la.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,n,a)=>Rr(e,i)});function Zo(e,t={}){return ha(Bo,e,t)}function Vo(e){return ma(e)}const Le=m("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");F.init(e,t),e.def=t,e.type=t.type,e.parse=(i,n)=>Jn(e,i,n,{callee:e.parse}),e.safeParse=(i,n)=>Hi(e,i,n),e.parseAsync=async(i,n)=>Xn(e,i,n,{callee:e.parseAsync}),e.safeParseAsync=async(i,n)=>Yi(e,i,n),e.check=(...i)=>e.clone({...t,checks:[...t.checks??[],...i.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(i,n)=>Ui(e,i,n),e.brand=()=>e,e.register=((i,n)=>(i.add(e,n),e)),e.apply=i=>i(e)}),$a=m("ZodMiniString",(e,t)=>{jt.init(e,t),Le.init(e,t)});function ka(e){return rr($a,e)}const He=m("ZodMiniStringFormat",(e,t)=>{ye.init(e,t),$a.init(e,t)}),Uo=m("ZodMiniEmail",(e,t)=>{Ms.init(e,t),He.init(e,t)});function Wo(e){return or(Uo,e)}const Go=m("ZodMiniUUID",(e,t)=>{Ls.init(e,t),He.init(e,t)});function Ho(e){return lr(Go,e)}const Yo=m("ZodMiniURL",(e,t)=>{zs.init(e,t),He.init(e,t)});function Ko(e){return dr(Yo,e)}const Jo=m("ZodMiniIPv4",(e,t)=>{Bs.init(e,t),He.init(e,t)});function Xo(e){return ur(Jo,e)}const Qo=m("ZodMiniIPv6",(e,t)=>{Zs.init(e,t),He.init(e,t)});function jo(e){return pr(Qo,e)}const el=m("ZodMiniCustomStringFormat",(e,t)=>{Vs.init(e,t),He.init(e,t)});function tl(e){return Lr(el,"hostname",us,e)}const _a=m("ZodMiniNumber",(e,t)=>{ji.init(e,t),Le.init(e,t)});function Ca(e){return fr(_a,e)}const il=m("ZodMiniNumberFormat",(e,t)=>{Us.init(e,t),_a.init(e,t)});function al(e){return gr(il,e)}const nl=m("ZodMiniBoolean",(e,t)=>{Ws.init(e,t),Le.init(e,t)});function Sa(e){return Dr(nl,e)}const sl=m("ZodMiniAny",(e,t)=>{Gs.init(e,t),Le.init(e,t)});function ii(){return br(sl)}const rl=m("ZodMiniArray",(e,t)=>{ta.init(e,t),Le.init(e,t)});function Oa(e,t){return new rl({type:"array",element:e,...v(t)})}const ol=m("ZodMiniOptional",(e,t)=>{ti.init(e,t),Le.init(e,t)});function ll(e){return new ol({type:"optional",innerType:e})}const dl=m("ZodMiniCustom",(e,t)=>{la.init(e,t),Le.init(e,t)});function H(e,t={}){return ha(dl,e,t)}function xa(e){return ma(e)}const ai={email:{schema:Wo()},hostname:{schema:tl()},ipv4:{schema:Xo()},ipv6:{schema:jo()},url:{schema:Ko()},uuid:{schema:Ho()},date:{schema:jr()},time:{schema:to()},"date-time":{schema:Xr()},duration:{schema:ao()}},ul=Object.keys(ai),pl=e=>(t,i)=>{switch(t.type){case"string":return cl(t,i);case"integer":case"number":return ml(t,i);case"boolean":return yl(t,i);case"array":return fl(t,i);case"custom":{if(!e)throw new Error('Validator type "custom" requires a customValidators object, but it was not supplied.');return gl(t,e)}}};function E(e,t){if(e!==void 0)return typeof e=="string"?e:t?.translate(e.key,e.params,e.default)??e.default}function cl(e,t){return tt(e,i=>{const n=E(i.messages?.invalid,t);let a=n?ka(n):ka();if(i.required===!0){const s=E(i.messages?.required,t)??"This field is required";a=a.check(H(r=>r.length>0,{error:s}))}if(typeof i.minLength=="number"){const s=E(i.messages?.minLength,t),r=i.minLength;a=a.check(s?H(l=>l.length>=r,{error:s}):We(r))}if(typeof i.maxLength=="number"){const s=E(i.messages?.maxLength,t),r=i.maxLength;a=a.check(s?H(l=>l.length<=r,{error:s}):Ft(r))}if(typeof i.pattern=="string"){const s=E(i.messages?.pattern,t),r=new RegExp(i.pattern);a=a.check(s?H(l=>r.test(l),{error:s}):ca(r))}if(i.enum){const s=i.enum,r=E(i.messages?.enum,t);a=a.check(H(l=>s.includes(l),r?{error:r}:void 0))}if(i.const!==void 0){const s=E(i.messages?.const,t);a=a.check(H(r=>r===i.const,s?{error:s}:void 0))}if(i.format!==void 0)if(ul.includes(i.format)){const s=E(i.messages?.format,t);a=a.check(s?xa((r,l)=>{const u=Ze.standardValidate(ai[i.format].schema,r);Ze.isStandardValidateSuccess(u)||l.addIssue({code:"custom",path:[],message:s})}):ai[i.format].schema)}else console.error(`The string validation format "${i.format}" is not supported`);return a})}const hl=(e,t)=>{if(t===0)return!1;const i=e/t;return Math.abs(i-Math.round(i))<1e-10};function ml(e,t){return tt(e,i=>{const n=E(i.messages?.invalid,t);let a=n?Ca(n):Ca();if(i.type==="integer"&&(a=a.check(al())),i.minimum!==void 0){const s=E(i.messages?.minimum,t),r=i.minimum;a=a.check(s?H(l=>l>=r,{error:s}):wr(r))}if(i.maximum!==void 0){const s=E(i.messages?.maximum,t),r=i.maximum;a=a.check(s?H(l=>l<=r,{error:s}):vr(r))}if(i.exclusiveMinimum!==void 0){const s=E(i.messages?.exclusiveMinimum,t),r=i.exclusiveMinimum;a=a.check(H(l=>l>r,s?{error:s}:void 0))}if(i.exclusiveMaximum!==void 0){const s=E(i.messages?.exclusiveMaximum,t),r=i.exclusiveMaximum;a=a.check(H(l=>l<r,s?{error:s}:void 0))}if(i.multipleOf!==void 0){const s=E(i.messages?.multipleOf,t),r=i.multipleOf;a=a.check(H(l=>hl(l,r),s?{error:s}:void 0))}if(i.enum){const s=i.enum,r=E(i.messages?.enum,t);a=a.check(H(l=>s.includes(l),r?{error:r}:void 0))}if(i.const!==void 0){const s=E(i.messages?.const,t);a=a.check(H(r=>r===i.const,s?{error:s}:void 0))}return a})}function yl(e,t){return tt(e,i=>{const n=E(i.messages?.invalid,t);let a=n?Sa(n):Sa();if(i.const!==void 0){const s=E(i.messages?.const,t);a=a.check(H(r=>r===i.const,s?{error:s}:void 0))}return a})}function fl(e,t){return tt(e,i=>{const n=E(i.messages?.invalid,t);let a=n?Oa(ii(),n):Oa(ii());if(i.required===!0){const s=E(i.messages?.required,t)??"This field is required";a=a.check(H(r=>r.length>0,{error:s}))}if(typeof i.minItems=="number"){const s=E(i.messages?.minItems,t),r=i.minItems;a=a.check(s?H(l=>l.length>=r,{error:s}):We(r))}if(typeof i.maxItems=="number"){const s=E(i.messages?.maxItems,t),r=i.maxItems;a=a.check(s?H(l=>l.length<=r,{error:s}):Ft(r))}return a})}function gl(e,t){return tt(e,i=>{let n=ii();return Ze.filterTap(Object.keys(i),a=>a!=="type"&&a!=="required",a=>{const s=i[a],r=t[a],l=r(s);n=n.check(xa((u,p)=>{const c=Ze.standardValidate(l,u);if(!Ze.isStandardValidateSuccess(c)){const h=c.issues[0];p.addIssue({code:"custom",path:[],message:h?.message||`Validation failed for ${a}`})}}))}),n})}function tt(e,t){const i=t(e);return e.required?i:ll(i)}var Dl=Object.defineProperty,bl=Object.getOwnPropertyDescriptor,qt=(e,t,i,n)=>{for(var a=n>1?void 0:n?bl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Dl(t,i,a),a};S.FormElement=class extends d.LitElement{constructor(){super(...arguments),this.autocomplete=void 0}setData(t){this.coreForm?.setData(t)}setMeta(t){this.coreForm?.setMeta(t)}createRenderRoot(){return this}render(){const t=this.config,i=Bn(t.formDef,t.formSelectors,t.formConfig),n={formDef:i.formDef,widgetLoaders:{...Pi,...i.widgetLoaders,...t.customWidgetLoaders??{}},dependencies:{...i.dependencies??{},...t.dependencies??{}},validateOn:t.validateOn??i.validateOn??"eager",itemRenderers:{...i.itemRenderers??{},...t.itemRenderers??{}},localization:t.localization,middlewares:t.middlewares??[],data:t.data,meta:t.meta,formName:t.formName},a=pl({...t.customValidators??{}}),s=i.formEvent,r=s?l=>s(l.detail):void 0;return d.html`
|
|
4
4
|
<gui-core-form
|
|
5
|
-
.config=${
|
|
6
|
-
.validators=${
|
|
5
|
+
.config=${n}
|
|
6
|
+
.validators=${a}
|
|
7
7
|
.autocomplete=${this.autocomplete}
|
|
8
|
-
@formEvent=${
|
|
8
|
+
@formEvent=${r}
|
|
9
9
|
></gui-core-form>
|
|
10
|
-
`}},
|
|
10
|
+
`}},qt([o.property({attribute:!1})],S.FormElement.prototype,"config",2),qt([o.property({type:String})],S.FormElement.prototype,"autocomplete",2),qt([o.query("gui-core-form")],S.FormElement.prototype,"coreForm",2),S.FormElement=qt([o.customElement("gui-form")],S.FormElement);var vl=Object.defineProperty,wl=Object.getOwnPropertyDescriptor,Me=(e,t,i,n)=>{for(var a=n>1?void 0:n?wl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&vl(t,i,a),a};let Se=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.disabled=!1,this.icon=void 0,this.variant="filled",this.iconPosition="left"}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}render(){const e=this.icon,t=this.iconPosition||"left",i={"gui-button-with-icon":!!e,[`gui-button-icon-${t}`]:!0,"gui-button--outlined":this.variant==="outlined","gui-button--link":this.variant==="link"},n=e?d.html`<span class="gui-widget-icon gui-button-icon ${e}" data-icon=${e}></span>`:d.nothing;return d.html`
|
|
11
|
+
<div class="gui-widget">
|
|
12
|
+
<button
|
|
13
|
+
type="button"
|
|
14
|
+
tabindex="0"
|
|
15
|
+
id=${this.uid}
|
|
16
|
+
class=${$.classMap(i)}
|
|
17
|
+
data-cy=${`${this.uid}_button`}
|
|
18
|
+
?disabled=${this.disabled}
|
|
19
|
+
>
|
|
20
|
+
${t==="left"?n:d.nothing}
|
|
21
|
+
${this.label?d.html`<span>${this.label}</span>`:d.nothing}
|
|
22
|
+
${t==="right"?n:d.nothing}
|
|
23
|
+
</button>
|
|
24
|
+
</div>
|
|
25
|
+
`}};Me([o.property({type:String})],Se.prototype,"uid",2),Me([o.property({type:String})],Se.prototype,"label",2),Me([o.property({type:Boolean})],Se.prototype,"disabled",2),Me([o.property({type:String})],Se.prototype,"icon",2),Me([o.property({type:String})],Se.prototype,"variant",2),Me([o.property({type:String})],Se.prototype,"iconPosition",2),Se=Me([o.customElement("gui-button")],Se),typeof customElements<"u"&&!customElements.get("gui-button")&&customElements.define("gui-button",Se);var $l=Object.defineProperty,kl=Object.getOwnPropertyDescriptor,ni=(e,t,i,n)=>{for(var a=n>1?void 0:n?kl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&$l(t,i,a),a};let it=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.ActionWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-button","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return d.html`
|
|
11
26
|
<gui-button
|
|
12
27
|
.uid=${this.widget.uid}
|
|
13
28
|
.label=${this.adapter.templateData.label}
|
|
@@ -17,7 +32,158 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17
32
|
.iconPosition=${this.adapter.templateData.iconPosition}
|
|
18
33
|
@click=${()=>this.adapter.click()}
|
|
19
34
|
></gui-button>
|
|
20
|
-
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};He([m.consume({context:p.formContext}),d.property({attribute:!1})],ne.prototype,"formContext",2),He([m.provide({context:p.actionContext})],ne.prototype,"adapter",2),ne=He([d.customElement("gui-button-interactive")],ne);const Wn=Object.freeze(Object.defineProperty({__proto__:null,get ButtonElement(){return ne}},Symbol.toStringTag,{value:"Module"}));var Jn=Object.defineProperty,Gn=Object.getOwnPropertyDescriptor,Ye=(e,t,a,r)=>{for(var i=r>1?void 0:r?Gn(t,a):t,n=e.length-1,s;n>=0;n--)(s=e[n])&&(i=(r?s(t,a,i):s(i))||i);return r&&i&&Jn(t,a,i),i};let se=class extends l.LitElement{constructor(){super(...arguments),this.adapter=new p.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-calendar","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),l.html`
|
|
35
|
+
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};ni([D.consume({context:y.formContext}),o.property({attribute:!1})],it.prototype,"formContext",2),ni([D.provide({context:y.actionContext})],it.prototype,"adapter",2),it=ni([o.customElement("gui-button-interactive")],it);const _l=Object.freeze(Object.defineProperty({__proto__:null,get ButtonElement(){return it}},Symbol.toStringTag,{value:"Module"})),Cl={aa:{firstDay:7,weekend:[6,7],minimalDays:1},"aa-DJ":{firstDay:6,weekend:[6,7],minimalDays:1},"aa-ER":{firstDay:1,weekend:[6,7],minimalDays:1},ab:{firstDay:1,weekend:[6,7],minimalDays:1},af:{firstDay:7,weekend:[6,7],minimalDays:1},"af-NA":{firstDay:1,weekend:[6,7],minimalDays:1},agq:{firstDay:1,weekend:[6,7],minimalDays:1},ak:{firstDay:1,weekend:[6,7],minimalDays:1},am:{firstDay:7,weekend:[6,7],minimalDays:1},an:{firstDay:1,weekend:[6,7],minimalDays:4},ann:{firstDay:1,weekend:[6,7],minimalDays:1},apc:{firstDay:6,weekend:[5,6],minimalDays:1},ar:{firstDay:6,weekend:[5,6],minimalDays:1},"ar-AE":{firstDay:6,weekend:[6,7],minimalDays:1},"ar-BH":{firstDay:6,weekend:[5,6],minimalDays:1},"ar-DJ":{firstDay:6,weekend:[6,7],minimalDays:1},"ar-DZ":{firstDay:6,weekend:[5,6],minimalDays:1},"ar-EG":{firstDay:6,weekend:[5,6],minimalDays:1},"ar-EH":{firstDay:1,weekend:[6,7],minimalDays:1},"ar-ER":{firstDay:1,weekend:[6,7],minimalDays:1},"ar-IL":{firstDay:7,weekend:[5,6],minimalDays:1},"ar-IQ":{firstDay:6,weekend:[5,6],minimalDays:1},"ar-JO":{firstDay:6,weekend:[5,6],minimalDays:1},"ar-KM":{firstDay:1,weekend:[6,7],minimalDays:1},"ar-KW":{firstDay:6,weekend:[5,6],minimalDays:1},"ar-LB":{firstDay:1,weekend:[6,7],minimalDays:1},"ar-LY":{firstDay:6,weekend:[5,6],minimalDays:1},"ar-MA":{firstDay:1,weekend:[6,7],minimalDays:1},"ar-MR":{firstDay:1,weekend:[6,7],minimalDays:1},"ar-OM":{firstDay:6,weekend:[5,6],minimalDays:1},"ar-PS":{firstDay:1,weekend:[6,7],minimalDays:1},"ar-QA":{firstDay:6,weekend:[5,6],minimalDays:1},"ar-SA":{firstDay:7,weekend:[5,6],minimalDays:1},"ar-SD":{firstDay:6,weekend:[5,6],minimalDays:1},"ar-SO":{firstDay:1,weekend:[6,7],minimalDays:1},"ar-SS":{firstDay:1,weekend:[6,7],minimalDays:1},"ar-SY":{firstDay:6,weekend:[5,6],minimalDays:1},"ar-TD":{firstDay:1,weekend:[6,7],minimalDays:1},"ar-TN":{firstDay:1,weekend:[6,7],minimalDays:1},"ar-YE":{firstDay:7,weekend:[5,6],minimalDays:1},arn:{firstDay:1,weekend:[6,7],minimalDays:1},as:{firstDay:7,weekend:[7],minimalDays:1},asa:{firstDay:1,weekend:[6,7],minimalDays:1},ast:{firstDay:1,weekend:[6,7],minimalDays:4},az:{firstDay:1,weekend:[6,7],minimalDays:1},"az-Arab":{firstDay:6,weekend:[5],minimalDays:1},"az-Arab-IQ":{firstDay:6,weekend:[5,6],minimalDays:1},"az-Arab-TR":{firstDay:1,weekend:[6,7],minimalDays:1},"az-Cyrl":{firstDay:1,weekend:[6,7],minimalDays:1},"az-Latn":{firstDay:1,weekend:[6,7],minimalDays:1},ba:{firstDay:1,weekend:[6,7],minimalDays:4},bal:{firstDay:7,weekend:[6,7],minimalDays:1},"bal-Arab":{firstDay:7,weekend:[6,7],minimalDays:1},"bal-Latn":{firstDay:7,weekend:[6,7],minimalDays:1},bas:{firstDay:1,weekend:[6,7],minimalDays:1},be:{firstDay:1,weekend:[6,7],minimalDays:1},"be-tarask":{firstDay:1,weekend:[6,7],minimalDays:1},bem:{firstDay:1,weekend:[6,7],minimalDays:1},bew:{firstDay:7,weekend:[6,7],minimalDays:1},bez:{firstDay:1,weekend:[6,7],minimalDays:1},bg:{firstDay:1,weekend:[6,7],minimalDays:4},bgc:{firstDay:7,weekend:[7],minimalDays:1},bgn:{firstDay:7,weekend:[6,7],minimalDays:1},"bgn-AE":{firstDay:6,weekend:[6,7],minimalDays:1},"bgn-AF":{firstDay:6,weekend:[4,5],minimalDays:1},"bgn-IR":{firstDay:6,weekend:[5],minimalDays:1},"bgn-OM":{firstDay:6,weekend:[5,6],minimalDays:1},bho:{firstDay:7,weekend:[7],minimalDays:1},blo:{firstDay:1,weekend:[6,7],minimalDays:1},blt:{firstDay:1,weekend:[6,7],minimalDays:1},bm:{firstDay:1,weekend:[6,7],minimalDays:1},"bm-Nkoo":{firstDay:1,weekend:[6,7],minimalDays:1},bn:{firstDay:7,weekend:[6,7],minimalDays:1},"bn-IN":{firstDay:7,weekend:[7],minimalDays:1},bo:{firstDay:1,weekend:[6,7],minimalDays:1},"bo-IN":{firstDay:7,weekend:[7],minimalDays:1},br:{firstDay:1,weekend:[6,7],minimalDays:4},brx:{firstDay:7,weekend:[7],minimalDays:1},bs:{firstDay:1,weekend:[6,7],minimalDays:1},"bs-Cyrl":{firstDay:1,weekend:[6,7],minimalDays:1},"bs-Latn":{firstDay:1,weekend:[6,7],minimalDays:1},bss:{firstDay:1,weekend:[6,7],minimalDays:1},byn:{firstDay:1,weekend:[6,7],minimalDays:1},ca:{firstDay:1,weekend:[6,7],minimalDays:4},"ca-AD":{firstDay:1,weekend:[6,7],minimalDays:4},"ca-ES-valencia":{firstDay:1,weekend:[6,7],minimalDays:4},"ca-FR":{firstDay:1,weekend:[6,7],minimalDays:4},"ca-IT":{firstDay:1,weekend:[6,7],minimalDays:4},cad:{firstDay:7,weekend:[6,7],minimalDays:1},cch:{firstDay:1,weekend:[6,7],minimalDays:1},ccp:{firstDay:7,weekend:[6,7],minimalDays:1},"ccp-IN":{firstDay:7,weekend:[7],minimalDays:1},ce:{firstDay:1,weekend:[6,7],minimalDays:4},ceb:{firstDay:7,weekend:[6,7],minimalDays:1},cgg:{firstDay:1,weekend:[7],minimalDays:1},cho:{firstDay:7,weekend:[6,7],minimalDays:1},chr:{firstDay:7,weekend:[6,7],minimalDays:1},cic:{firstDay:7,weekend:[6,7],minimalDays:1},ckb:{firstDay:6,weekend:[5,6],minimalDays:1},"ckb-IR":{firstDay:6,weekend:[5],minimalDays:1},co:{firstDay:1,weekend:[6,7],minimalDays:4},cs:{firstDay:1,weekend:[6,7],minimalDays:4},csw:{firstDay:7,weekend:[6,7],minimalDays:1},cu:{firstDay:1,weekend:[6,7],minimalDays:4},cv:{firstDay:1,weekend:[6,7],minimalDays:4},cy:{firstDay:1,weekend:[6,7],minimalDays:4},da:{firstDay:1,weekend:[6,7],minimalDays:4},"da-GL":{firstDay:1,weekend:[6,7],minimalDays:1},dav:{firstDay:7,weekend:[6,7],minimalDays:1},de:{firstDay:1,weekend:[6,7],minimalDays:4},"de-AT":{firstDay:1,weekend:[6,7],minimalDays:4},"de-BE":{firstDay:1,weekend:[6,7],minimalDays:4},"de-CH":{firstDay:1,weekend:[6,7],minimalDays:4},"de-IT":{firstDay:1,weekend:[6,7],minimalDays:4},"de-LI":{firstDay:1,weekend:[6,7],minimalDays:4},"de-LU":{firstDay:1,weekend:[6,7],minimalDays:4},dje:{firstDay:1,weekend:[6,7],minimalDays:1},doi:{firstDay:7,weekend:[7],minimalDays:1},dsb:{firstDay:1,weekend:[6,7],minimalDays:4},dua:{firstDay:1,weekend:[6,7],minimalDays:1},dv:{firstDay:5,weekend:[6,7],minimalDays:1},dyo:{firstDay:1,weekend:[6,7],minimalDays:1},dz:{firstDay:7,weekend:[6,7],minimalDays:1},ebu:{firstDay:7,weekend:[6,7],minimalDays:1},ee:{firstDay:1,weekend:[6,7],minimalDays:1},"ee-TG":{firstDay:1,weekend:[6,7],minimalDays:1},el:{firstDay:1,weekend:[6,7],minimalDays:4},"el-CY":{firstDay:1,weekend:[6,7],minimalDays:1},"el-polyton":{firstDay:1,weekend:[6,7],minimalDays:4},en:{firstDay:7,weekend:[6,7],minimalDays:1},"en-001":{firstDay:1,weekend:[6,7],minimalDays:1},"en-150":{firstDay:1,weekend:[6,7],minimalDays:1},"en-AE":{firstDay:6,weekend:[6,7],minimalDays:1},"en-AG":{firstDay:7,weekend:[6,7],minimalDays:1},"en-AI":{firstDay:1,weekend:[6,7],minimalDays:1},"en-AS":{firstDay:7,weekend:[6,7],minimalDays:1},"en-AT":{firstDay:1,weekend:[6,7],minimalDays:4},"en-AU":{firstDay:1,weekend:[6,7],minimalDays:1},"en-BB":{firstDay:1,weekend:[6,7],minimalDays:1},"en-BE":{firstDay:1,weekend:[6,7],minimalDays:4},"en-BI":{firstDay:1,weekend:[6,7],minimalDays:1},"en-BM":{firstDay:1,weekend:[6,7],minimalDays:1},"en-BS":{firstDay:7,weekend:[6,7],minimalDays:1},"en-BW":{firstDay:7,weekend:[6,7],minimalDays:1},"en-BZ":{firstDay:7,weekend:[6,7],minimalDays:1},"en-CA":{firstDay:7,weekend:[6,7],minimalDays:1},"en-CC":{firstDay:1,weekend:[6,7],minimalDays:1},"en-CH":{firstDay:1,weekend:[6,7],minimalDays:4},"en-CK":{firstDay:1,weekend:[6,7],minimalDays:1},"en-CM":{firstDay:1,weekend:[6,7],minimalDays:1},"en-CX":{firstDay:1,weekend:[6,7],minimalDays:1},"en-CY":{firstDay:1,weekend:[6,7],minimalDays:1},"en-DE":{firstDay:1,weekend:[6,7],minimalDays:4},"en-DG":{firstDay:1,weekend:[6,7],minimalDays:1},"en-DK":{firstDay:1,weekend:[6,7],minimalDays:4},"en-DM":{firstDay:7,weekend:[6,7],minimalDays:1},"en-Dsrt":{firstDay:7,weekend:[6,7],minimalDays:1},"en-ER":{firstDay:1,weekend:[6,7],minimalDays:1},"en-FI":{firstDay:1,weekend:[6,7],minimalDays:4},"en-FJ":{firstDay:1,weekend:[6,7],minimalDays:4},"en-FK":{firstDay:1,weekend:[6,7],minimalDays:1},"en-FM":{firstDay:1,weekend:[6,7],minimalDays:1},"en-GB":{firstDay:1,weekend:[6,7],minimalDays:4},"en-GD":{firstDay:1,weekend:[6,7],minimalDays:1},"en-GG":{firstDay:1,weekend:[6,7],minimalDays:4},"en-GH":{firstDay:1,weekend:[6,7],minimalDays:1},"en-GI":{firstDay:1,weekend:[6,7],minimalDays:4},"en-GM":{firstDay:1,weekend:[6,7],minimalDays:1},"en-GU":{firstDay:7,weekend:[6,7],minimalDays:1},"en-GY":{firstDay:1,weekend:[6,7],minimalDays:1},"en-HK":{firstDay:7,weekend:[6,7],minimalDays:1},"en-ID":{firstDay:7,weekend:[6,7],minimalDays:1},"en-IE":{firstDay:1,weekend:[6,7],minimalDays:4},"en-IL":{firstDay:7,weekend:[5,6],minimalDays:1},"en-IM":{firstDay:1,weekend:[6,7],minimalDays:4},"en-IN":{firstDay:7,weekend:[7],minimalDays:1},"en-IO":{firstDay:1,weekend:[6,7],minimalDays:1},"en-JE":{firstDay:1,weekend:[6,7],minimalDays:4},"en-JM":{firstDay:7,weekend:[6,7],minimalDays:1},"en-KE":{firstDay:7,weekend:[6,7],minimalDays:1},"en-KI":{firstDay:1,weekend:[6,7],minimalDays:1},"en-KN":{firstDay:1,weekend:[6,7],minimalDays:1},"en-KY":{firstDay:1,weekend:[6,7],minimalDays:1},"en-LC":{firstDay:1,weekend:[6,7],minimalDays:1},"en-LR":{firstDay:1,weekend:[6,7],minimalDays:1},"en-LS":{firstDay:1,weekend:[6,7],minimalDays:1},"en-MG":{firstDay:1,weekend:[6,7],minimalDays:1},"en-MH":{firstDay:7,weekend:[6,7],minimalDays:1},"en-MO":{firstDay:7,weekend:[6,7],minimalDays:1},"en-MP":{firstDay:1,weekend:[6,7],minimalDays:1},"en-MS":{firstDay:1,weekend:[6,7],minimalDays:1},"en-MT":{firstDay:7,weekend:[6,7],minimalDays:1},"en-MU":{firstDay:1,weekend:[6,7],minimalDays:1},"en-MV":{firstDay:5,weekend:[6,7],minimalDays:1},"en-MW":{firstDay:1,weekend:[6,7],minimalDays:1},"en-MY":{firstDay:1,weekend:[6,7],minimalDays:1},"en-NA":{firstDay:1,weekend:[6,7],minimalDays:1},"en-NF":{firstDay:1,weekend:[6,7],minimalDays:1},"en-NG":{firstDay:1,weekend:[6,7],minimalDays:1},"en-NL":{firstDay:1,weekend:[6,7],minimalDays:4},"en-NR":{firstDay:1,weekend:[6,7],minimalDays:1},"en-NU":{firstDay:1,weekend:[6,7],minimalDays:1},"en-NZ":{firstDay:1,weekend:[6,7],minimalDays:1},"en-PG":{firstDay:1,weekend:[6,7],minimalDays:1},"en-PH":{firstDay:7,weekend:[6,7],minimalDays:1},"en-PK":{firstDay:7,weekend:[6,7],minimalDays:1},"en-PN":{firstDay:1,weekend:[6,7],minimalDays:1},"en-PR":{firstDay:7,weekend:[6,7],minimalDays:1},"en-PW":{firstDay:1,weekend:[6,7],minimalDays:1},"en-RW":{firstDay:1,weekend:[6,7],minimalDays:1},"en-SB":{firstDay:1,weekend:[6,7],minimalDays:1},"en-SC":{firstDay:1,weekend:[6,7],minimalDays:1},"en-SD":{firstDay:6,weekend:[5,6],minimalDays:1},"en-SE":{firstDay:1,weekend:[6,7],minimalDays:4},"en-SG":{firstDay:7,weekend:[6,7],minimalDays:1},"en-SH":{firstDay:1,weekend:[6,7],minimalDays:1},"en-SI":{firstDay:1,weekend:[6,7],minimalDays:1},"en-SL":{firstDay:1,weekend:[6,7],minimalDays:1},"en-SS":{firstDay:1,weekend:[6,7],minimalDays:1},"en-SX":{firstDay:1,weekend:[6,7],minimalDays:1},"en-SZ":{firstDay:1,weekend:[6,7],minimalDays:1},"en-Shaw":{firstDay:1,weekend:[6,7],minimalDays:4},"en-TC":{firstDay:1,weekend:[6,7],minimalDays:1},"en-TK":{firstDay:1,weekend:[6,7],minimalDays:1},"en-TO":{firstDay:1,weekend:[6,7],minimalDays:1},"en-TT":{firstDay:7,weekend:[6,7],minimalDays:1},"en-TV":{firstDay:1,weekend:[6,7],minimalDays:1},"en-TZ":{firstDay:1,weekend:[6,7],minimalDays:1},"en-UG":{firstDay:1,weekend:[7],minimalDays:1},"en-UM":{firstDay:7,weekend:[6,7],minimalDays:1},"en-VC":{firstDay:1,weekend:[6,7],minimalDays:1},"en-VG":{firstDay:1,weekend:[6,7],minimalDays:1},"en-VI":{firstDay:7,weekend:[6,7],minimalDays:1},"en-VU":{firstDay:1,weekend:[6,7],minimalDays:1},"en-WS":{firstDay:7,weekend:[6,7],minimalDays:1},"en-ZA":{firstDay:7,weekend:[6,7],minimalDays:1},"en-ZM":{firstDay:1,weekend:[6,7],minimalDays:1},"en-ZW":{firstDay:7,weekend:[6,7],minimalDays:1},eo:{firstDay:1,weekend:[6,7],minimalDays:1},es:{firstDay:1,weekend:[6,7],minimalDays:4},"es-419":{firstDay:1,weekend:[6,7],minimalDays:1},"es-AR":{firstDay:1,weekend:[6,7],minimalDays:1},"es-BO":{firstDay:1,weekend:[6,7],minimalDays:1},"es-BR":{firstDay:7,weekend:[6,7],minimalDays:1},"es-BZ":{firstDay:7,weekend:[6,7],minimalDays:1},"es-CL":{firstDay:1,weekend:[6,7],minimalDays:1},"es-CO":{firstDay:7,weekend:[6,7],minimalDays:1},"es-CR":{firstDay:1,weekend:[6,7],minimalDays:1},"es-CU":{firstDay:1,weekend:[6,7],minimalDays:1},"es-DO":{firstDay:7,weekend:[6,7],minimalDays:1},"es-EA":{firstDay:1,weekend:[6,7],minimalDays:1},"es-EC":{firstDay:1,weekend:[6,7],minimalDays:1},"es-GQ":{firstDay:1,weekend:[6,7],minimalDays:1},"es-GT":{firstDay:7,weekend:[6,7],minimalDays:1},"es-HN":{firstDay:7,weekend:[6,7],minimalDays:1},"es-IC":{firstDay:1,weekend:[6,7],minimalDays:1},"es-MX":{firstDay:7,weekend:[6,7],minimalDays:1},"es-NI":{firstDay:7,weekend:[6,7],minimalDays:1},"es-PA":{firstDay:7,weekend:[6,7],minimalDays:1},"es-PE":{firstDay:7,weekend:[6,7],minimalDays:1},"es-PH":{firstDay:7,weekend:[6,7],minimalDays:1},"es-PR":{firstDay:7,weekend:[6,7],minimalDays:1},"es-PY":{firstDay:7,weekend:[6,7],minimalDays:1},"es-SV":{firstDay:7,weekend:[6,7],minimalDays:1},"es-US":{firstDay:7,weekend:[6,7],minimalDays:1},"es-UY":{firstDay:1,weekend:[6,7],minimalDays:1},"es-VE":{firstDay:7,weekend:[6,7],minimalDays:1},et:{firstDay:1,weekend:[6,7],minimalDays:4},eu:{firstDay:1,weekend:[6,7],minimalDays:4},ewo:{firstDay:1,weekend:[6,7],minimalDays:1},fa:{firstDay:6,weekend:[5],minimalDays:1},"fa-AF":{firstDay:6,weekend:[4,5],minimalDays:1},ff:{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm-BF":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm-CM":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm-GH":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm-GM":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm-GW":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm-LR":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm-MR":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm-NE":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm-NG":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm-SL":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Adlm-SN":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn-BF":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn-CM":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn-GH":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn-GM":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn-GN":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn-GW":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn-LR":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn-MR":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn-NE":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn-NG":{firstDay:1,weekend:[6,7],minimalDays:1},"ff-Latn-SL":{firstDay:1,weekend:[6,7],minimalDays:1},fi:{firstDay:1,weekend:[6,7],minimalDays:4},fil:{firstDay:7,weekend:[6,7],minimalDays:1},fo:{firstDay:1,weekend:[6,7],minimalDays:4},"fo-DK":{firstDay:1,weekend:[6,7],minimalDays:4},fr:{firstDay:1,weekend:[6,7],minimalDays:4},"fr-BE":{firstDay:1,weekend:[6,7],minimalDays:4},"fr-BF":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-BI":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-BJ":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-BL":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-CA":{firstDay:7,weekend:[6,7],minimalDays:1},"fr-CD":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-CF":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-CG":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-CH":{firstDay:1,weekend:[6,7],minimalDays:4},"fr-CI":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-CM":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-DJ":{firstDay:6,weekend:[6,7],minimalDays:1},"fr-DZ":{firstDay:6,weekend:[5,6],minimalDays:1},"fr-GA":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-GF":{firstDay:1,weekend:[6,7],minimalDays:4},"fr-GN":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-GP":{firstDay:1,weekend:[6,7],minimalDays:4},"fr-GQ":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-HT":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-KM":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-LU":{firstDay:1,weekend:[6,7],minimalDays:4},"fr-MA":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-MC":{firstDay:1,weekend:[6,7],minimalDays:4},"fr-MF":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-MG":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-ML":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-MQ":{firstDay:1,weekend:[6,7],minimalDays:4},"fr-MR":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-MU":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-NC":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-NE":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-PF":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-PM":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-RE":{firstDay:1,weekend:[6,7],minimalDays:4},"fr-RW":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-SC":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-SN":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-SY":{firstDay:6,weekend:[5,6],minimalDays:1},"fr-TD":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-TG":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-TN":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-VU":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-WF":{firstDay:1,weekend:[6,7],minimalDays:1},"fr-YT":{firstDay:1,weekend:[6,7],minimalDays:1},frr:{firstDay:1,weekend:[6,7],minimalDays:4},fur:{firstDay:1,weekend:[6,7],minimalDays:4},fy:{firstDay:1,weekend:[6,7],minimalDays:4},ga:{firstDay:1,weekend:[6,7],minimalDays:4},"ga-GB":{firstDay:1,weekend:[6,7],minimalDays:4},gaa:{firstDay:1,weekend:[6,7],minimalDays:1},gd:{firstDay:1,weekend:[6,7],minimalDays:4},gez:{firstDay:7,weekend:[6,7],minimalDays:1},"gez-ER":{firstDay:1,weekend:[6,7],minimalDays:1},gl:{firstDay:1,weekend:[6,7],minimalDays:4},gn:{firstDay:7,weekend:[6,7],minimalDays:1},gsw:{firstDay:1,weekend:[6,7],minimalDays:4},"gsw-FR":{firstDay:1,weekend:[6,7],minimalDays:4},"gsw-LI":{firstDay:1,weekend:[6,7],minimalDays:4},gu:{firstDay:7,weekend:[7],minimalDays:1},guz:{firstDay:7,weekend:[6,7],minimalDays:1},gv:{firstDay:1,weekend:[6,7],minimalDays:4},ha:{firstDay:1,weekend:[6,7],minimalDays:1},"ha-Arab":{firstDay:1,weekend:[6,7],minimalDays:1},"ha-Arab-SD":{firstDay:6,weekend:[5,6],minimalDays:1},"ha-GH":{firstDay:1,weekend:[6,7],minimalDays:1},"ha-NE":{firstDay:1,weekend:[6,7],minimalDays:1},haw:{firstDay:7,weekend:[6,7],minimalDays:1},he:{firstDay:7,weekend:[5,6],minimalDays:1},hi:{firstDay:7,weekend:[7],minimalDays:1},"hi-Latn":{firstDay:7,weekend:[7],minimalDays:1},hnj:{firstDay:7,weekend:[6,7],minimalDays:1},"hnj-Hmnp":{firstDay:7,weekend:[6,7],minimalDays:1},hr:{firstDay:1,weekend:[6,7],minimalDays:1},"hr-BA":{firstDay:1,weekend:[6,7],minimalDays:1},hsb:{firstDay:1,weekend:[6,7],minimalDays:4},hu:{firstDay:1,weekend:[6,7],minimalDays:4},hy:{firstDay:1,weekend:[6,7],minimalDays:1},ia:{firstDay:1,weekend:[6,7],minimalDays:1},id:{firstDay:7,weekend:[6,7],minimalDays:1},ie:{firstDay:1,weekend:[6,7],minimalDays:4},ig:{firstDay:1,weekend:[6,7],minimalDays:1},ii:{firstDay:1,weekend:[6,7],minimalDays:1},io:{firstDay:1,weekend:[6,7],minimalDays:1},is:{firstDay:1,weekend:[6,7],minimalDays:4},it:{firstDay:1,weekend:[6,7],minimalDays:4},"it-CH":{firstDay:1,weekend:[6,7],minimalDays:4},"it-SM":{firstDay:1,weekend:[6,7],minimalDays:4},"it-VA":{firstDay:1,weekend:[6,7],minimalDays:4},iu:{firstDay:7,weekend:[6,7],minimalDays:1},"iu-Latn":{firstDay:7,weekend:[6,7],minimalDays:1},ja:{firstDay:7,weekend:[6,7],minimalDays:1},jbo:{firstDay:1,weekend:[6,7],minimalDays:1},jgo:{firstDay:1,weekend:[6,7],minimalDays:1},jmc:{firstDay:1,weekend:[6,7],minimalDays:1},jv:{firstDay:7,weekend:[6,7],minimalDays:1},ka:{firstDay:1,weekend:[6,7],minimalDays:1},kab:{firstDay:6,weekend:[5,6],minimalDays:1},kaj:{firstDay:1,weekend:[6,7],minimalDays:1},kam:{firstDay:7,weekend:[6,7],minimalDays:1},kcg:{firstDay:1,weekend:[6,7],minimalDays:1},kde:{firstDay:1,weekend:[6,7],minimalDays:1},kea:{firstDay:1,weekend:[6,7],minimalDays:1},ken:{firstDay:1,weekend:[6,7],minimalDays:1},kgp:{firstDay:7,weekend:[6,7],minimalDays:1},khq:{firstDay:1,weekend:[6,7],minimalDays:1},ki:{firstDay:7,weekend:[6,7],minimalDays:1},kk:{firstDay:1,weekend:[6,7],minimalDays:1},kkj:{firstDay:1,weekend:[6,7],minimalDays:1},kl:{firstDay:1,weekend:[6,7],minimalDays:1},kln:{firstDay:7,weekend:[6,7],minimalDays:1},km:{firstDay:7,weekend:[6,7],minimalDays:1},kn:{firstDay:7,weekend:[7],minimalDays:1},ko:{firstDay:7,weekend:[6,7],minimalDays:1},"ko-CN":{firstDay:1,weekend:[6,7],minimalDays:1},"ko-KP":{firstDay:1,weekend:[6,7],minimalDays:1},kok:{firstDay:7,weekend:[7],minimalDays:1},kpe:{firstDay:1,weekend:[6,7],minimalDays:1},"kpe-GN":{firstDay:1,weekend:[6,7],minimalDays:1},ks:{firstDay:7,weekend:[7],minimalDays:1},"ks-Arab":{firstDay:7,weekend:[7],minimalDays:1},"ks-Deva":{firstDay:7,weekend:[7],minimalDays:1},ksb:{firstDay:1,weekend:[6,7],minimalDays:1},ksf:{firstDay:1,weekend:[6,7],minimalDays:1},ksh:{firstDay:1,weekend:[6,7],minimalDays:4},ku:{firstDay:1,weekend:[6,7],minimalDays:1},kw:{firstDay:1,weekend:[6,7],minimalDays:4},kxv:{firstDay:7,weekend:[7],minimalDays:1},"kxv-Deva":{firstDay:7,weekend:[7],minimalDays:1},"kxv-Latn":{firstDay:7,weekend:[7],minimalDays:1},"kxv-Orya":{firstDay:7,weekend:[7],minimalDays:1},"kxv-Telu":{firstDay:7,weekend:[7],minimalDays:1},ky:{firstDay:1,weekend:[6,7],minimalDays:1},la:{firstDay:1,weekend:[6,7],minimalDays:4},lag:{firstDay:1,weekend:[6,7],minimalDays:1},lb:{firstDay:1,weekend:[6,7],minimalDays:4},lg:{firstDay:1,weekend:[7],minimalDays:1},lij:{firstDay:1,weekend:[6,7],minimalDays:4},lkt:{firstDay:7,weekend:[6,7],minimalDays:1},lmo:{firstDay:1,weekend:[6,7],minimalDays:4},ln:{firstDay:1,weekend:[6,7],minimalDays:1},"ln-AO":{firstDay:1,weekend:[6,7],minimalDays:1},"ln-CF":{firstDay:1,weekend:[6,7],minimalDays:1},"ln-CG":{firstDay:1,weekend:[6,7],minimalDays:1},lo:{firstDay:7,weekend:[6,7],minimalDays:1},lrc:{firstDay:6,weekend:[5],minimalDays:1},"lrc-IQ":{firstDay:6,weekend:[5,6],minimalDays:1},lt:{firstDay:1,weekend:[6,7],minimalDays:4},lu:{firstDay:1,weekend:[6,7],minimalDays:1},luo:{firstDay:7,weekend:[6,7],minimalDays:1},luy:{firstDay:7,weekend:[6,7],minimalDays:1},lv:{firstDay:1,weekend:[6,7],minimalDays:1},mai:{firstDay:7,weekend:[7],minimalDays:1},mas:{firstDay:7,weekend:[6,7],minimalDays:1},"mas-TZ":{firstDay:1,weekend:[6,7],minimalDays:1},mdf:{firstDay:1,weekend:[6,7],minimalDays:4},mer:{firstDay:7,weekend:[6,7],minimalDays:1},mfe:{firstDay:1,weekend:[6,7],minimalDays:1},mg:{firstDay:1,weekend:[6,7],minimalDays:1},mgh:{firstDay:7,weekend:[6,7],minimalDays:1},mgo:{firstDay:1,weekend:[6,7],minimalDays:1},mi:{firstDay:1,weekend:[6,7],minimalDays:1},mic:{firstDay:7,weekend:[6,7],minimalDays:1},mk:{firstDay:1,weekend:[6,7],minimalDays:1},ml:{firstDay:7,weekend:[7],minimalDays:1},mn:{firstDay:1,weekend:[6,7],minimalDays:1},"mn-Mong":{firstDay:1,weekend:[6,7],minimalDays:1},"mn-Mong-MN":{firstDay:1,weekend:[6,7],minimalDays:1},mni:{firstDay:7,weekend:[7],minimalDays:1},"mni-Beng":{firstDay:7,weekend:[7],minimalDays:1},"mni-Mtei":{firstDay:7,weekend:[7],minimalDays:1},moh:{firstDay:7,weekend:[6,7],minimalDays:1},mr:{firstDay:7,weekend:[7],minimalDays:1},ms:{firstDay:1,weekend:[6,7],minimalDays:1},"ms-Arab":{firstDay:1,weekend:[6,7],minimalDays:1},"ms-Arab-BN":{firstDay:1,weekend:[6,7],minimalDays:1},"ms-BN":{firstDay:1,weekend:[6,7],minimalDays:1},"ms-ID":{firstDay:7,weekend:[6,7],minimalDays:1},"ms-SG":{firstDay:7,weekend:[6,7],minimalDays:1},mt:{firstDay:7,weekend:[6,7],minimalDays:1},mua:{firstDay:1,weekend:[6,7],minimalDays:1},mus:{firstDay:7,weekend:[6,7],minimalDays:1},my:{firstDay:7,weekend:[6,7],minimalDays:1},myv:{firstDay:1,weekend:[6,7],minimalDays:4},mzn:{firstDay:6,weekend:[5],minimalDays:1},naq:{firstDay:1,weekend:[6,7],minimalDays:1},nb:{firstDay:1,weekend:[6,7],minimalDays:4},"nb-SJ":{firstDay:1,weekend:[6,7],minimalDays:4},nd:{firstDay:7,weekend:[6,7],minimalDays:1},nds:{firstDay:1,weekend:[6,7],minimalDays:4},"nds-NL":{firstDay:1,weekend:[6,7],minimalDays:4},ne:{firstDay:7,weekend:[6,7],minimalDays:1},"ne-IN":{firstDay:7,weekend:[7],minimalDays:1},nl:{firstDay:1,weekend:[6,7],minimalDays:4},"nl-AW":{firstDay:1,weekend:[6,7],minimalDays:1},"nl-BE":{firstDay:1,weekend:[6,7],minimalDays:4},"nl-BQ":{firstDay:1,weekend:[6,7],minimalDays:1},"nl-CW":{firstDay:1,weekend:[6,7],minimalDays:1},"nl-SR":{firstDay:1,weekend:[6,7],minimalDays:1},"nl-SX":{firstDay:1,weekend:[6,7],minimalDays:1},nmg:{firstDay:1,weekend:[6,7],minimalDays:1},nn:{firstDay:1,weekend:[6,7],minimalDays:4},nnh:{firstDay:1,weekend:[6,7],minimalDays:1},no:{firstDay:1,weekend:[6,7],minimalDays:4},nqo:{firstDay:1,weekend:[6,7],minimalDays:1},nr:{firstDay:7,weekend:[6,7],minimalDays:1},nso:{firstDay:7,weekend:[6,7],minimalDays:1},nus:{firstDay:1,weekend:[6,7],minimalDays:1},nv:{firstDay:7,weekend:[6,7],minimalDays:1},ny:{firstDay:1,weekend:[6,7],minimalDays:1},nyn:{firstDay:1,weekend:[7],minimalDays:1},oc:{firstDay:1,weekend:[6,7],minimalDays:4},"oc-ES":{firstDay:1,weekend:[6,7],minimalDays:4},om:{firstDay:7,weekend:[6,7],minimalDays:1},"om-KE":{firstDay:7,weekend:[6,7],minimalDays:1},or:{firstDay:7,weekend:[7],minimalDays:1},os:{firstDay:1,weekend:[6,7],minimalDays:1},"os-RU":{firstDay:1,weekend:[6,7],minimalDays:4},osa:{firstDay:7,weekend:[6,7],minimalDays:1},pa:{firstDay:7,weekend:[7],minimalDays:1},"pa-Arab":{firstDay:7,weekend:[6,7],minimalDays:1},"pa-Guru":{firstDay:7,weekend:[7],minimalDays:1},pap:{firstDay:1,weekend:[6,7],minimalDays:1},"pap-AW":{firstDay:1,weekend:[6,7],minimalDays:1},pcm:{firstDay:1,weekend:[6,7],minimalDays:1},pis:{firstDay:1,weekend:[6,7],minimalDays:1},pl:{firstDay:1,weekend:[6,7],minimalDays:4},prg:{firstDay:1,weekend:[6,7],minimalDays:4},ps:{firstDay:6,weekend:[4,5],minimalDays:1},"ps-PK":{firstDay:7,weekend:[6,7],minimalDays:1},pt:{firstDay:7,weekend:[6,7],minimalDays:1},"pt-AO":{firstDay:1,weekend:[6,7],minimalDays:1},"pt-CH":{firstDay:1,weekend:[6,7],minimalDays:4},"pt-CV":{firstDay:1,weekend:[6,7],minimalDays:1},"pt-GQ":{firstDay:1,weekend:[6,7],minimalDays:1},"pt-GW":{firstDay:1,weekend:[6,7],minimalDays:1},"pt-LU":{firstDay:1,weekend:[6,7],minimalDays:4},"pt-MO":{firstDay:7,weekend:[6,7],minimalDays:1},"pt-MZ":{firstDay:7,weekend:[6,7],minimalDays:1},"pt-PT":{firstDay:7,weekend:[6,7],minimalDays:4},"pt-ST":{firstDay:1,weekend:[6,7],minimalDays:1},"pt-TL":{firstDay:1,weekend:[6,7],minimalDays:1},qu:{firstDay:7,weekend:[6,7],minimalDays:1},"qu-BO":{firstDay:1,weekend:[6,7],minimalDays:1},"qu-EC":{firstDay:1,weekend:[6,7],minimalDays:1},quc:{firstDay:7,weekend:[6,7],minimalDays:1},raj:{firstDay:7,weekend:[7],minimalDays:1},rhg:{firstDay:7,weekend:[6,7],minimalDays:1},"rhg-Rohg":{firstDay:7,weekend:[6,7],minimalDays:1},"rhg-Rohg-BD":{firstDay:7,weekend:[6,7],minimalDays:1},rif:{firstDay:1,weekend:[6,7],minimalDays:1},rm:{firstDay:1,weekend:[6,7],minimalDays:4},rn:{firstDay:1,weekend:[6,7],minimalDays:1},ro:{firstDay:1,weekend:[6,7],minimalDays:1},"ro-MD":{firstDay:1,weekend:[6,7],minimalDays:1},rof:{firstDay:1,weekend:[6,7],minimalDays:1},ru:{firstDay:1,weekend:[6,7],minimalDays:4},"ru-BY":{firstDay:1,weekend:[6,7],minimalDays:1},"ru-KG":{firstDay:1,weekend:[6,7],minimalDays:1},"ru-KZ":{firstDay:1,weekend:[6,7],minimalDays:1},"ru-MD":{firstDay:1,weekend:[6,7],minimalDays:1},"ru-UA":{firstDay:1,weekend:[6,7],minimalDays:1},rw:{firstDay:1,weekend:[6,7],minimalDays:1},rwk:{firstDay:1,weekend:[6,7],minimalDays:1},sa:{firstDay:7,weekend:[7],minimalDays:1},sah:{firstDay:1,weekend:[6,7],minimalDays:4},saq:{firstDay:7,weekend:[6,7],minimalDays:1},sat:{firstDay:7,weekend:[7],minimalDays:1},"sat-Deva":{firstDay:7,weekend:[7],minimalDays:1},"sat-Olck":{firstDay:7,weekend:[7],minimalDays:1},sbp:{firstDay:1,weekend:[6,7],minimalDays:1},sc:{firstDay:1,weekend:[6,7],minimalDays:4},scn:{firstDay:1,weekend:[6,7],minimalDays:4},sd:{firstDay:7,weekend:[6,7],minimalDays:1},"sd-Arab":{firstDay:7,weekend:[6,7],minimalDays:1},"sd-Deva":{firstDay:7,weekend:[7],minimalDays:1},sdh:{firstDay:6,weekend:[5],minimalDays:1},"sdh-IQ":{firstDay:6,weekend:[5,6],minimalDays:1},se:{firstDay:1,weekend:[6,7],minimalDays:4},"se-FI":{firstDay:1,weekend:[6,7],minimalDays:4},"se-SE":{firstDay:1,weekend:[6,7],minimalDays:4},seh:{firstDay:7,weekend:[6,7],minimalDays:1},ses:{firstDay:1,weekend:[6,7],minimalDays:1},sg:{firstDay:1,weekend:[6,7],minimalDays:1},shi:{firstDay:1,weekend:[6,7],minimalDays:1},"shi-Latn":{firstDay:1,weekend:[6,7],minimalDays:1},"shi-Tfng":{firstDay:1,weekend:[6,7],minimalDays:1},shn:{firstDay:7,weekend:[6,7],minimalDays:1},"shn-TH":{firstDay:7,weekend:[6,7],minimalDays:1},si:{firstDay:1,weekend:[6,7],minimalDays:1},sid:{firstDay:7,weekend:[6,7],minimalDays:1},sk:{firstDay:1,weekend:[6,7],minimalDays:4},skr:{firstDay:7,weekend:[6,7],minimalDays:1},sl:{firstDay:1,weekend:[6,7],minimalDays:1},sma:{firstDay:1,weekend:[6,7],minimalDays:4},"sma-NO":{firstDay:1,weekend:[6,7],minimalDays:4},smj:{firstDay:1,weekend:[6,7],minimalDays:4},"smj-NO":{firstDay:1,weekend:[6,7],minimalDays:4},smn:{firstDay:1,weekend:[6,7],minimalDays:4},sms:{firstDay:1,weekend:[6,7],minimalDays:4},sn:{firstDay:7,weekend:[6,7],minimalDays:1},so:{firstDay:1,weekend:[6,7],minimalDays:1},"so-DJ":{firstDay:6,weekend:[6,7],minimalDays:1},"so-ET":{firstDay:7,weekend:[6,7],minimalDays:1},"so-KE":{firstDay:7,weekend:[6,7],minimalDays:1},sq:{firstDay:1,weekend:[6,7],minimalDays:1},"sq-MK":{firstDay:1,weekend:[6,7],minimalDays:1},"sq-XK":{firstDay:1,weekend:[6,7],minimalDays:1},sr:{firstDay:1,weekend:[6,7],minimalDays:1},"sr-Cyrl":{firstDay:1,weekend:[6,7],minimalDays:1},"sr-Cyrl-BA":{firstDay:1,weekend:[6,7],minimalDays:1},"sr-Cyrl-ME":{firstDay:1,weekend:[6,7],minimalDays:1},"sr-Cyrl-XK":{firstDay:1,weekend:[6,7],minimalDays:1},"sr-Latn":{firstDay:1,weekend:[6,7],minimalDays:1},"sr-Latn-BA":{firstDay:1,weekend:[6,7],minimalDays:1},"sr-Latn-ME":{firstDay:1,weekend:[6,7],minimalDays:1},"sr-Latn-XK":{firstDay:1,weekend:[6,7],minimalDays:1},ss:{firstDay:7,weekend:[6,7],minimalDays:1},"ss-SZ":{firstDay:1,weekend:[6,7],minimalDays:1},ssy:{firstDay:1,weekend:[6,7],minimalDays:1},st:{firstDay:7,weekend:[6,7],minimalDays:1},"st-LS":{firstDay:1,weekend:[6,7],minimalDays:1},su:{firstDay:7,weekend:[6,7],minimalDays:1},"su-Latn":{firstDay:7,weekend:[6,7],minimalDays:1},sv:{firstDay:1,weekend:[6,7],minimalDays:4},"sv-AX":{firstDay:1,weekend:[6,7],minimalDays:4},"sv-FI":{firstDay:1,weekend:[6,7],minimalDays:4},sw:{firstDay:1,weekend:[6,7],minimalDays:1},"sw-CD":{firstDay:1,weekend:[6,7],minimalDays:1},"sw-KE":{firstDay:7,weekend:[6,7],minimalDays:1},"sw-UG":{firstDay:1,weekend:[7],minimalDays:1},syr:{firstDay:6,weekend:[5,6],minimalDays:1},"syr-SY":{firstDay:6,weekend:[5,6],minimalDays:1},szl:{firstDay:1,weekend:[6,7],minimalDays:4},ta:{firstDay:7,weekend:[7],minimalDays:1},"ta-LK":{firstDay:1,weekend:[6,7],minimalDays:1},"ta-MY":{firstDay:1,weekend:[6,7],minimalDays:1},"ta-SG":{firstDay:7,weekend:[6,7],minimalDays:1},te:{firstDay:7,weekend:[7],minimalDays:1},teo:{firstDay:1,weekend:[7],minimalDays:1},"teo-KE":{firstDay:7,weekend:[6,7],minimalDays:1},tg:{firstDay:1,weekend:[6,7],minimalDays:1},th:{firstDay:7,weekend:[6,7],minimalDays:1},ti:{firstDay:7,weekend:[6,7],minimalDays:1},"ti-ER":{firstDay:1,weekend:[6,7],minimalDays:1},tig:{firstDay:1,weekend:[6,7],minimalDays:1},tk:{firstDay:1,weekend:[6,7],minimalDays:1},tn:{firstDay:7,weekend:[6,7],minimalDays:1},"tn-BW":{firstDay:7,weekend:[6,7],minimalDays:1},to:{firstDay:1,weekend:[6,7],minimalDays:1},tok:{firstDay:1,weekend:[6,7],minimalDays:1},tpi:{firstDay:1,weekend:[6,7],minimalDays:1},tr:{firstDay:1,weekend:[6,7],minimalDays:1},"tr-CY":{firstDay:1,weekend:[6,7],minimalDays:1},trv:{firstDay:7,weekend:[6,7],minimalDays:1},trw:{firstDay:7,weekend:[6,7],minimalDays:1},ts:{firstDay:7,weekend:[6,7],minimalDays:1},tt:{firstDay:1,weekend:[6,7],minimalDays:4},twq:{firstDay:1,weekend:[6,7],minimalDays:1},tyv:{firstDay:1,weekend:[6,7],minimalDays:4},tzm:{firstDay:1,weekend:[6,7],minimalDays:1},ug:{firstDay:1,weekend:[6,7],minimalDays:1},uk:{firstDay:1,weekend:[6,7],minimalDays:1},und:{firstDay:7,weekend:[6,7],minimalDays:1},ur:{firstDay:7,weekend:[6,7],minimalDays:1},"ur-IN":{firstDay:7,weekend:[7],minimalDays:1},uz:{firstDay:1,weekend:[6,7],minimalDays:1},"uz-Arab":{firstDay:6,weekend:[4,5],minimalDays:1},"uz-Cyrl":{firstDay:1,weekend:[6,7],minimalDays:1},"uz-Latn":{firstDay:1,weekend:[6,7],minimalDays:1},vai:{firstDay:1,weekend:[6,7],minimalDays:1},"vai-Latn":{firstDay:1,weekend:[6,7],minimalDays:1},"vai-Vaii":{firstDay:1,weekend:[6,7],minimalDays:1},ve:{firstDay:7,weekend:[6,7],minimalDays:1},vec:{firstDay:1,weekend:[6,7],minimalDays:4},vi:{firstDay:1,weekend:[6,7],minimalDays:1},vmw:{firstDay:7,weekend:[6,7],minimalDays:1},vo:{firstDay:1,weekend:[6,7],minimalDays:1},vun:{firstDay:1,weekend:[6,7],minimalDays:1},wa:{firstDay:1,weekend:[6,7],minimalDays:4},wae:{firstDay:1,weekend:[6,7],minimalDays:4},wal:{firstDay:7,weekend:[6,7],minimalDays:1},wbp:{firstDay:1,weekend:[6,7],minimalDays:1},wo:{firstDay:1,weekend:[6,7],minimalDays:1},xh:{firstDay:7,weekend:[6,7],minimalDays:1},xnr:{firstDay:7,weekend:[7],minimalDays:1},xog:{firstDay:1,weekend:[7],minimalDays:1},yav:{firstDay:1,weekend:[6,7],minimalDays:1},yi:{firstDay:1,weekend:[6,7],minimalDays:1},yo:{firstDay:1,weekend:[6,7],minimalDays:1},"yo-BJ":{firstDay:1,weekend:[6,7],minimalDays:1},yrl:{firstDay:7,weekend:[6,7],minimalDays:1},"yrl-CO":{firstDay:7,weekend:[6,7],minimalDays:1},"yrl-VE":{firstDay:7,weekend:[6,7],minimalDays:1},yue:{firstDay:7,weekend:[6,7],minimalDays:1},"yue-Hans":{firstDay:1,weekend:[6,7],minimalDays:1},"yue-Hant":{firstDay:7,weekend:[6,7],minimalDays:1},za:{firstDay:1,weekend:[6,7],minimalDays:1},zgh:{firstDay:1,weekend:[6,7],minimalDays:1},zh:{firstDay:1,weekend:[6,7],minimalDays:1},"zh-Hans":{firstDay:1,weekend:[6,7],minimalDays:1},"zh-Hans-HK":{firstDay:7,weekend:[6,7],minimalDays:1},"zh-Hans-MO":{firstDay:7,weekend:[6,7],minimalDays:1},"zh-Hans-SG":{firstDay:7,weekend:[6,7],minimalDays:1},"zh-Hant":{firstDay:7,weekend:[6,7],minimalDays:1},"zh-Hant-HK":{firstDay:7,weekend:[6,7],minimalDays:1},"zh-Hant-MO":{firstDay:7,weekend:[6,7],minimalDays:1},zu:{firstDay:7,weekend:[6,7],minimalDays:1}};function Oe(e){const t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${i}-${n}`}function Ea(e){return at(e,new Date)}function at(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}function Sl(e){const t=[0,1,2,3,4,5,6],i=e%7;return[...t.slice(i),...t.slice(0,i)]}function Pa(e){const t=Cl[e??"en"]||{firstDay:0};return Sl(t.firstDay)}function Ol(e){const t=new Intl.DateTimeFormat(e,{weekday:"narrow"}),i=new Date(2025,10,30);return Pa(e).map(n=>{const a=new Date(i);return a.setDate(i.getDate()+n),t.format(a)})}function ze(e,t,i){for(let n=0;n<i;n++){const a=new Date(t.getFullYear(),t.getMonth()+n,1);if(e.getMonth()===a.getMonth()&&e.getFullYear()===a.getFullYear())return!0}return!1}function xl(e,t,i="long"){return new Intl.DateTimeFormat(e,{month:i,year:"numeric"}).formatToParts(t).filter(a=>a.type==="month"||a.type==="year")}function Ia(e,t){const i=e||"en-US",s=new Intl.DateTimeFormat(i,{day:"numeric"}).formatToParts(t).find(r=>r.type==="day");return s?s.value:t.getDate().toString()}function si(e,t){const i=Oe(e),n=Oe(t);return i===n?{start:i}:{start:i,end:n}}function Aa(e){return e.length?e.map(n=>({start:new Date(n.start).getTime(),end:new Date(n.end??n.start).getTime()})).sort((n,a)=>n.start-a.start).reduce((n,a)=>{const s=n[n.length-1];if(s){const r=new Date(s.end);if(r.setDate(r.getDate()+1),a.start<=r.getTime())return s.end=Math.max(s.end,a.end),n}return[...n,a]},[]).map(n=>si(new Date(n.start),new Date(n.end))):[]}class oe{constructor(t,i){t.addController(this),this.getTargets=i.getTargets,this.getState=i.getState}hostConnected(){}hostUpdated(){const t=this.getTargets();if(!t)return;let i=[];t instanceof NodeList?i=Array.from(t):Array.isArray(t)?i=t:i=[t];const{uid:n,templateData:a}=this.getState(),{touched:s,errors:r,readonly:l,disabled:u,hint:p}=a,c=s&&r&&r.length>0;Ze.filterTap(i,h=>!!h,h=>{const f=(g,_)=>{_?h.setAttribute(g,_):h.removeAttribute(g)};f("aria-describedby",p?`${n}_hint`:null),f("aria-invalid",c?"true":null),f("aria-errormessage",c?`${n}_errors`:null),f("aria-readonly",u||l?"true":null)})}}const le=(e,t,i=!1,n=void 0,a=!0)=>a?t.label?d.html`<label
|
|
36
|
+
class="gui-label"
|
|
37
|
+
for=${e}
|
|
38
|
+
data-cy=${`${e}_label`}
|
|
39
|
+
id=${n?`${e}_${n}_label`:`${e}_label`}
|
|
40
|
+
>
|
|
41
|
+
${t.label+(t.required?" *":"")} ${Ta(e,t)}
|
|
42
|
+
${i?V(e,t):d.nothing}
|
|
43
|
+
</label>`:d.nothing:t.label?d.html`<span
|
|
44
|
+
class="gui-label"
|
|
45
|
+
data-cy=${`${e}_label`}
|
|
46
|
+
id=${n?`${e}_${n}_label`:`${e}_label`}
|
|
47
|
+
>
|
|
48
|
+
${t.label+(t.required?" *":"")} ${Ta(e,t)}
|
|
49
|
+
${i?V(e,t):d.nothing}
|
|
50
|
+
</span>`:d.nothing,Ta=(e,t)=>t.hint?d.html`<div class="gui-widget-hint" id=${`${e}_hint`}>${t.hint}</div>`:d.html``,Fe=(e,t)=>{const i={[`gui-${e}--icon`]:!1,[`gui-${e}--icon-right`]:!1};if(t.icon){i[`gui-${e}--icon`]=!0;const n={"gui-widget-icon":!0,[t.icon]:!0};return{widgetClasses:i,html:d.html`<span class=${$.classMap(n)} data-icon=${t.icon}></span>`}}else return{widgetClasses:i,html:d.html``}},V=(e,t)=>{const i=t.touched&&t.errors&&t.errors.length>0;return d.html`${i?d.html`<ul class="gui-validator" id=${`${e}_errors`} data-cy=${`${e}_validator-errors`}>
|
|
51
|
+
${t.errors?.map(n=>d.html`<li class="gui-validator__error" role="alert" data-cy=${`${e}_validator-error`}>
|
|
52
|
+
${n}
|
|
53
|
+
</li>`)}
|
|
54
|
+
</ul>`:""}`};var El=Object.defineProperty,P=(e,t,i,n)=>{for(var a=void 0,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=r(t,i,a)||a);return a&&El(t,i,a),a};class O extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.hint=void 0,this.localeId=void 0,this.errors=[],this.touched=void 0,this.required=!1,this.disabled=!1,this.readOnly=!1,this.prevMonthIcon="",this.nextMonthIcon="",this.prevMonthAriaLabel="",this.nextMonthAriaLabel="",this.dayFormat="numeric",this.weekdayFormat="narrow",this.monthFormat="long",this.minDate=void 0,this.maxDate=void 0,this.disabledRanges=void 0,this.numberOfMonths=1,this._currentDate=new Date,this._yearSelectorOpen=!1,this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(".gui-calendar-input"),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,readonly:this.readOnly,disabled:this.disabled,touched:this.touched}})})}renderAboveCalendar(){return d.nothing}render(){const t={uid:this.uid,label:this.label,hint:this.hint,errors:this.errors,touched:this.touched,required:this.required},i=Array.from({length:this.numberOfMonths??1},(n,a)=>a);return d.html`
|
|
55
|
+
${this.label?le(this.uid,t,!1,"calendar"):d.nothing}
|
|
56
|
+
|
|
57
|
+
<div class="gui-widget" @focusout=${this.onFocusOut}>
|
|
58
|
+
<div
|
|
59
|
+
id=${this.uid}
|
|
60
|
+
class="gui-calendar-input"
|
|
61
|
+
role="group"
|
|
62
|
+
aria-labelledby=${this.label?`${this.uid}_calendar_label`:d.nothing}
|
|
63
|
+
?aria-disabled=${this.disabled}
|
|
64
|
+
>
|
|
65
|
+
${this.renderAboveCalendar()}
|
|
66
|
+
<div class="gui-calendar__container">
|
|
67
|
+
<button
|
|
68
|
+
type="button"
|
|
69
|
+
tabindex="0"
|
|
70
|
+
class="gui-button gui-calendar__month-button gui-calendar__month-button--prev"
|
|
71
|
+
?disabled=${!this.canGoPrev()}
|
|
72
|
+
@click=${this.prevMonth}
|
|
73
|
+
aria-label=${this.prevMonthAriaLabel??"Previous month"}
|
|
74
|
+
>
|
|
75
|
+
${this.prevMonthIcon?d.html`<span
|
|
76
|
+
class=${`gui-widget-icon ${this.prevMonthIcon}`}
|
|
77
|
+
data-icon=${this.prevMonthIcon}
|
|
78
|
+
></span>`:"<"}
|
|
79
|
+
</button>
|
|
80
|
+
|
|
81
|
+
<div class="gui-calendar__months-grid">
|
|
82
|
+
${i.map(n=>this.renderMonthPanel(n))}
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<button
|
|
86
|
+
type="button"
|
|
87
|
+
tabindex="0"
|
|
88
|
+
class="gui-button gui-calendar__month-button gui-calendar__month-button--next"
|
|
89
|
+
?disabled=${!this.canGoNext()}
|
|
90
|
+
@click=${this.nextMonth}
|
|
91
|
+
aria-label=${this.nextMonthAriaLabel??"Next month"}
|
|
92
|
+
>
|
|
93
|
+
${this.nextMonthIcon?d.html`<span
|
|
94
|
+
class=${`gui-widget-icon ${this.nextMonthIcon}`}
|
|
95
|
+
data-icon=${this.nextMonthIcon}
|
|
96
|
+
></span>`:">"}
|
|
97
|
+
</button>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
${this.errors?.length?V(this.uid,t):d.nothing}
|
|
103
|
+
`}renderMonthPanel(t){const i=this.getDaysInMonth(t),n=this.chunkDays(i),a=Ol(this.localeId),s=new Date(this._currentDate);return s.setDate(1),s.setMonth(s.getMonth()+t),d.html`
|
|
104
|
+
<div class="gui-calendar__panel">
|
|
105
|
+
${this.renderHeader(s)}
|
|
106
|
+
${this._yearSelectorOpen&&t===0?this.renderYearGrid():d.html`
|
|
107
|
+
<div class="gui-calendar__days-grid" role="grid">
|
|
108
|
+
<div role="row" class="gui-calendar__rows">
|
|
109
|
+
${Q.repeat(a,(r,l)=>l,r=>d.html`<span class="gui-calendar__weekday" role="gridcell">${r}</span>`)}
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
${Q.repeat(n,r=>d.html`
|
|
113
|
+
<div role="row" class="gui-calendar__rows">
|
|
114
|
+
${Q.repeat(r,l=>l.date.toISOString(),l=>this.renderDay(l))}
|
|
115
|
+
</div>
|
|
116
|
+
`)}
|
|
117
|
+
</div>
|
|
118
|
+
`}
|
|
119
|
+
</div>
|
|
120
|
+
`}renderHeader(t){const i=xl(this.localeId,t,this.monthFormat);return d.html`
|
|
121
|
+
<header class="gui-calendar__header">
|
|
122
|
+
<h2>
|
|
123
|
+
${i.map(n=>n.type==="year"?d.html`<button
|
|
124
|
+
type="button"
|
|
125
|
+
tabindex="0"
|
|
126
|
+
class="gui-calendar__year-selector"
|
|
127
|
+
@click=${this.toggleYearSelector}
|
|
128
|
+
aria-expanded=${this._yearSelectorOpen}
|
|
129
|
+
aria-label="Select year"
|
|
130
|
+
>
|
|
131
|
+
<span class="gui-calendar__year-value">${n.value}</span>
|
|
132
|
+
<span class="gui-calendar__year-arrow" aria-hidden="true">
|
|
133
|
+
<svg
|
|
134
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
135
|
+
width="16"
|
|
136
|
+
height="16"
|
|
137
|
+
viewBox="0 0 256 256"
|
|
138
|
+
>
|
|
139
|
+
<path
|
|
140
|
+
d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"
|
|
141
|
+
></path>
|
|
142
|
+
</svg>
|
|
143
|
+
</span>
|
|
144
|
+
</button>`:d.html`<span class="gui-calendar__month-name">${n.value}</span>`)}
|
|
145
|
+
</h2>
|
|
146
|
+
</header>
|
|
147
|
+
`}renderYearGrid(){const t=this._currentDate.getFullYear(),i=this._yearList;return d.html`
|
|
148
|
+
<div
|
|
149
|
+
class="gui-calendar__year-grid"
|
|
150
|
+
role="grid"
|
|
151
|
+
aria-label="Year selection"
|
|
152
|
+
@keydown=${this.handleYearKeydown}
|
|
153
|
+
>
|
|
154
|
+
${this.chunkYears(i).map(n=>d.html`
|
|
155
|
+
<div role="row" class="gui-calendar__year-row">
|
|
156
|
+
${n.map(a=>d.html`
|
|
157
|
+
<button
|
|
158
|
+
type="button"
|
|
159
|
+
role="gridcell"
|
|
160
|
+
class="gui-calendar__year-button ${a===t?"current":""}"
|
|
161
|
+
tabindex=${a===t?0:-1}
|
|
162
|
+
data-year=${a}
|
|
163
|
+
@click=${s=>{s.stopPropagation(),this.selectYear(a)}}
|
|
164
|
+
aria-selected=${a===t}
|
|
165
|
+
>
|
|
166
|
+
${a}
|
|
167
|
+
</button>
|
|
168
|
+
`)}
|
|
169
|
+
</div>
|
|
170
|
+
`)}
|
|
171
|
+
</div>
|
|
172
|
+
`}chunkYears(t){const i=[];for(let n=0;n<t.length;n+=4)i.push(t.slice(n,n+4));return i}toggleYearSelector(){this._yearSelectorOpen=!this._yearSelectorOpen,this._yearSelectorOpen&&this.updateComplete.then(()=>{this.scrollToCurrentYear(),this.focusCurrentYearButton()})}selectYear(t){this.querySelector(".gui-calendar__year-selector")?.focus();const n=this._currentDate;this._currentDate=new Date(t,n.getMonth(),1),this._yearSelectorOpen=!1,this.updateComplete.then(()=>{this.querySelector('.gui-calendar__day-button[tabindex="0"]')?.focus()})}scrollToCurrentYear(){const t=this.querySelector(".gui-calendar__year-grid"),i=this.querySelector(".gui-calendar__year-button.current");if(t&&i){const n=t.getBoundingClientRect(),a=i.getBoundingClientRect(),s=t.scrollTop+(a.top-n.top)-n.height/2+a.height/2;t.scrollTop=Math.max(0,s)}}focusCurrentYearButton(){this.querySelector(".gui-calendar__year-button.current")?.focus()}handleYearKeydown(t){const i=t.target;if(!i.classList.contains("gui-calendar__year-button"))return;const n=Array.from(this.querySelectorAll(".gui-calendar__year-button")),a=n.indexOf(i),s=window.getComputedStyle(this).direction==="rtl";let r=0;switch(t.key){case"ArrowLeft":r=s?1:-1;break;case"ArrowRight":r=s?-1:1;break;case"ArrowUp":r=-4;break;case"ArrowDown":r=4;break;case"Enter":case" ":{t.preventDefault();const u=parseInt(i.dataset.year??"",10);isNaN(u)||this.selectYear(u);return}case"Escape":{t.preventDefault(),this.querySelector(".gui-calendar__year-selector")?.focus(),this._yearSelectorOpen=!1;return}default:return}t.preventDefault();const l=a+r;l>=0&&l<n.length&&n[l].focus()}get _effectiveMinYear(){return this.minDate?new Date(this.minDate).getFullYear():1900}get _effectiveMaxYear(){return this.maxDate?new Date(this.maxDate).getFullYear():2099}get _yearList(){const t=[];for(let i=this._effectiveMinYear;i<=this._effectiveMaxYear;i++)t.push(i);return t}async handleKeydown(t,i){if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.key)&&t.key!==" "&&t.key!=="Enter")return;const a=Array.from(this.querySelectorAll(".gui-calendar__day-button:not(.other-month)")),s=a.indexOf(t.target),r=window.getComputedStyle(this).direction==="rtl";let l=0;switch(t.key){case"ArrowLeft":l=r?1:-1;break;case"ArrowRight":l=r?-1:1;break;case"ArrowUp":l=-7;break;case"ArrowDown":l=7;break;case" ":case"Enter":t.preventDefault(),this.selectDate(i,t);return}t.preventDefault();const u=this.findNextFocusableIndex(s,l,a);let p=!1;if(u<0)if(this.canGoPrev())this.prevMonth(),p=!0;else{a.find(h=>!this.isButtonDisabled(h))?.focus();return}else if(u>=a.length)if(this.canGoNext())this.nextMonth(),p=!0;else{[...a].reverse().find(f=>!this.isButtonDisabled(f))?.focus();return}if(p){await this.updateComplete;const c=Array.from(this.querySelectorAll(".gui-calendar__day-button:not(.other-month)")),h=Array.from(this.querySelectorAll(".gui-calendar__panel"));let f;if(u<0)f=h[0].querySelectorAll(".gui-calendar__day-button:not(.other-month)").length+u;else{const _=h[h.length-1].querySelectorAll(".gui-calendar__day-button:not(.other-month)").length;f=c.length-_+(u-a.length)}if(this.isButtonDisabled(c[f])){const g=this.findNextFocusableIndex(f,l,c);if(g<0||g>=c.length){const _=c.findIndex(T=>!this.isButtonDisabled(T));_>-1&&c[_].focus()}else c[g]?.focus()}else{const g=Math.max(0,Math.min(f,c.length-1));c[g]?.focus()}}else a[u]?.focus()}chunkDays(t){const i=[];for(let n=0;n<t.length;n+=7)i.push(t.slice(n,n+7));return i}onFocusOut(t){t.relatedTarget&&this.contains(t.relatedTarget)||(this._blurRafId!==void 0&&cancelAnimationFrame(this._blurRafId),this._blurRafId=requestAnimationFrame(()=>{this._blurRafId=void 0,this.contains(document.activeElement)||this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0}))}))}disconnectedCallback(){super.disconnectedCallback(),this._blurRafId!==void 0&&cancelAnimationFrame(this._blurRafId)}isDisabled(t){const i=Oe(t);if(this.minDate&&i<this.minDate||this.maxDate&&i>this.maxDate)return!0;if(this.disabledRanges&&this.disabledRanges.length>0)for(const n of this.disabledRanges){const a=n.start.split("T")[0],s=n.end?n.end.split("T")[0]:a;if(i>=a&&i<=s)return!0}return!1}prevMonth(){const t=this._currentDate;this._currentDate=new Date(t.getFullYear(),t.getMonth()-1,1)}nextMonth(){const t=this._currentDate;this._currentDate=new Date(t.getFullYear(),t.getMonth()+1,1)}generateDateGrid(t=0){const i=this._currentDate.getFullYear(),n=this._currentDate.getMonth()+t,a=new Date(i,n,1),s=a.getDay(),r=Pa(this.localeId)[0],l=(s-r+7)%7,u=new Date(a);u.setDate(a.getDate()-l);const p=[];for(let c=0;c<42;c++){const h=new Date(u);h.setDate(u.getDate()+c),p.push(h)}return p}findNextFocusableIndex(t,i,n){let a=t+i;for(;a>=0&&a<n.length;){const s=n[a];if(!this.isButtonDisabled(s))return a;a+=i}return a}isButtonDisabled(t){return t?t.hasAttribute("disabled"):!0}canGoPrev(){if(!this.minDate)return!0;const t=new Date(this._currentDate.getFullYear(),this._currentDate.getMonth(),0);return Oe(t)>=this.minDate}canGoNext(){if(!this.maxDate)return!0;const t=(this.numberOfMonths??1)-1,i=new Date(this._currentDate.getFullYear(),this._currentDate.getMonth()+t+1,1);return Oe(i)<=this.maxDate}}P([o.property({type:String})],O.prototype,"uid"),P([o.property({type:String})],O.prototype,"label"),P([o.property({type:String})],O.prototype,"hint"),P([o.property({type:String,attribute:"locale-id"})],O.prototype,"localeId"),P([o.property({type:Array})],O.prototype,"errors"),P([o.property({type:Boolean})],O.prototype,"touched"),P([o.property({type:Boolean})],O.prototype,"required"),P([o.property({type:Boolean})],O.prototype,"disabled"),P([o.property({type:Boolean,attribute:"readonly"})],O.prototype,"readOnly"),P([o.property({type:String,attribute:"prev-month-icon"})],O.prototype,"prevMonthIcon"),P([o.property({type:String,attribute:"next-month-icon"})],O.prototype,"nextMonthIcon"),P([o.property({type:String,attribute:"prev-month-aria-label"})],O.prototype,"prevMonthAriaLabel"),P([o.property({type:String,attribute:"next-month-aria-label"})],O.prototype,"nextMonthAriaLabel"),P([o.property({type:String})],O.prototype,"dayFormat"),P([o.property({type:String})],O.prototype,"weekdayFormat"),P([o.property({type:String})],O.prototype,"monthFormat"),P([o.property({type:String})],O.prototype,"minDate"),P([o.property({type:String})],O.prototype,"maxDate"),P([o.property({type:Array})],O.prototype,"disabledRanges"),P([o.property({type:Number})],O.prototype,"numberOfMonths"),P([o.state()],O.prototype,"_currentDate"),P([o.state()],O.prototype,"_yearSelectorOpen");var Pl=Object.defineProperty,Il=Object.getOwnPropertyDescriptor,La=(e,t,i,n)=>{for(var a=n>1?void 0:n?Il(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Pl(t,i,a),a};let Bt=class extends O{constructor(){super(...arguments),this.value=void 0}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}willUpdate(e){if(e.has("value")&&this.value){const t=new Date(this.value);!isNaN(t.getTime())&&!ze(t,this._currentDate,this.numberOfMonths??1)&&(this._currentDate=t)}}renderDay(e){const t={"gui-calendar__day-button":!0,today:e.isToday,selected:e.isSelected,disabled:e.isDisabled,"other-month":!e.isCurrentMonth};return d.html`
|
|
173
|
+
<button
|
|
174
|
+
type="button"
|
|
175
|
+
role="gridcell"
|
|
176
|
+
class=${$.classMap(t)}
|
|
177
|
+
tabindex=${e.isFocusable?0:-1}
|
|
178
|
+
?disabled=${!e.isCurrentMonth||e.isDisabled}
|
|
179
|
+
data-date=${e.date.toISOString()}
|
|
180
|
+
@click=${()=>this.selectDate(e)}
|
|
181
|
+
@keydown=${i=>this.handleKeydown(i,e)}
|
|
182
|
+
aria-selected=${e.isSelected}
|
|
183
|
+
>
|
|
184
|
+
${e.dayLabel}
|
|
185
|
+
</button>
|
|
186
|
+
`}getDaysInMonth(e){const t=new Date(this._currentDate);t.setDate(1),t.setMonth(t.getMonth()+e);const i=this.generateDateGrid(e),n=t.getMonth();let a=i.map(s=>{const r=s.getMonth()===n,l=this.isDisabled(s),u=!!this.value&&at(s,new Date(this.value)),p=Ea(s),c=(u||p)&&r;return{date:s,dayLabel:Ia(this.localeId,s),isCurrentMonth:r,isToday:p,isDisabled:l,isSelected:u,isFocusable:c}});for(let s=0;s<2;s++)a.slice(-7).every(l=>!l.isCurrentMonth)&&(a=a.slice(0,-7));if(e===0&&!a.some(s=>s.isFocusable)){const s=this.value?new Date(this.value):new Date;if(!ze(s,this._currentDate,this.numberOfMonths??1)){const r=a.find(l=>l.isCurrentMonth&&!l.isDisabled);r&&(r.isFocusable=!0)}}return a}selectDate(e){if(!e.isCurrentMonth||e.isDisabled||this.disabled||this.readOnly)return;const t=Oe(e.date);this.value=t,this.dispatchEvent(new CustomEvent("change",{detail:{value:t},bubbles:!0,composed:!0}))}};La([o.property({type:String})],Bt.prototype,"value",2),Bt=La([o.customElement("gui-calendar")],Bt),typeof customElements<"u"&&!customElements.get("gui-calendar")&&customElements.define("gui-calendar",Bt);var Al=Object.defineProperty,Tl=Object.getOwnPropertyDescriptor,ri=(e,t,i,n)=>{for(var a=n>1?void 0:n?Tl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Al(t,i,a),a};let nt=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-calendar","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
21
187
|
<gui-calendar
|
|
22
188
|
.uid=${this.widget.uid}
|
|
23
189
|
.label=${this.adapter.templateData.label}
|
|
@@ -43,7 +209,64 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
43
209
|
@change=${this.valueChanged}
|
|
44
210
|
@blur=${()=>this.adapter.onBlur()}
|
|
45
211
|
></gui-calendar>
|
|
46
|
-
`}valueChanged(e){const t=e?.target;this.adapter.valueChanged(t.value)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
212
|
+
`}valueChanged(e){const t=e?.target;this.adapter.valueChanged(t.value)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};ri([D.consume({context:y.formContext}),o.property({attribute:!1})],nt.prototype,"formContext",2),ri([D.provide({context:y.inputContext})],nt.prototype,"adapter",2),nt=ri([o.customElement("gui-calendar-input")],nt);const Ll=Object.freeze(Object.defineProperty({__proto__:null,get CalendarElement(){return nt}},Symbol.toStringTag,{value:"Module"}));function Ye(e,t,i){if(!e)throw new TypeError("The element provided to the IntersectionObserver must exist");const n=new IntersectionObserver(a=>{a.forEach(s=>{t(s.isIntersecting)})},i);return n.observe(e),n}var Ml=Object.defineProperty,zl=Object.getOwnPropertyDescriptor,ke=(e,t,i,n)=>{for(var a=n>1?void 0:n?zl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Ml(t,i,a),a};let ge=class extends O{constructor(){super(...arguments),this.value=[],this.focusDate=void 0,this.hidePills=!1,this.removePillAriaLabel=void 0,this._anchorDate=null,this._nextDate=null,this._isSelecting=!1,this._isStartVisible=!0,this._isEndVisible=!0,this._skipValueNavigation=!1}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}willUpdate(e){if(e.has("value")&&!e.has("focusDate")){if(this._skipValueNavigation)this._skipValueNavigation=!1;else if(this.value){const t=Array.isArray(this.value)?this.value:[{start:this.value}];if(t.length>0&&t[0].start){const i=new Date(t[0].start);!isNaN(i.getTime())&&!ze(i,this._currentDate,this.numberOfMonths??1)&&(this._currentDate=i)}}}if(e.has("focusDate")&&this.focusDate){const t=new Date(this.focusDate);isNaN(t.getTime())||(ze(t,this._currentDate,this.numberOfMonths??1)||(this._currentDate=t),this.focusDate=void 0)}}renderDay(e){const t={"gui-calendar__day-button":!0,today:e.isToday,"other-month":!e.isCurrentMonth,"range-start":e.isRangeStart&&!e.isOneDayRange,"range-end":e.isRangeEnd&&!e.isOneDayRange,selected:e.isOneDayRange,"in-range":e.isInRange,"is-anchor":e.isAnchor,"is-selecting":e.isSelecting,disabled:e.isDisabled};return d.html`
|
|
213
|
+
<button
|
|
214
|
+
type="button"
|
|
215
|
+
role="gridcell"
|
|
216
|
+
class=${$.classMap(t)}
|
|
217
|
+
tabindex=${e.isFocusable?0:-1}
|
|
218
|
+
?disabled=${!e.isCurrentMonth||e.isDisabled}
|
|
219
|
+
data-date=${e.date.toISOString()}
|
|
220
|
+
@click=${i=>this.selectDate(e,i)}
|
|
221
|
+
@mouseover=${()=>this.onMouseOver(e)}
|
|
222
|
+
@focus=${()=>this.onMouseOver(e)}
|
|
223
|
+
@keydown=${i=>this.handleKeydown(i,e)}
|
|
224
|
+
aria-selected=${e.isRangeStart||e.isRangeEnd||e.isInRange?"true":"false"}
|
|
225
|
+
>
|
|
226
|
+
${e.dayLabel}
|
|
227
|
+
</button>
|
|
228
|
+
`}getDaysInMonth(e){const t=new Date(this._currentDate);t.setDate(1),t.setMonth(t.getMonth()+e);const i=this.generateDateGrid(e),n=t.getMonth();let a=i.map(s=>{const r=s.getMonth()===n,l=this.isDisabled(s),u=Ea(s),{isRangeStart:p,isRangeEnd:c,isInRange:h,isSelecting:f}=this.checkDateStatus(s),g=u||p,_=this._anchorDate?at(s,this._anchorDate):!1;return{date:s,dayLabel:Ia(this.localeId,s),isCurrentMonth:r,isToday:u,isRangeStart:p,isRangeEnd:c,isInRange:h,isDisabled:l,isOneDayRange:p&&c,isAnchor:_,isFocusable:g,isSelecting:f&&r}});for(let s=0;s<2;s++)a.slice(-7).every(l=>!l.isCurrentMonth)&&(a=a.slice(0,-7));if(e===0&&!a.some(s=>s.isFocusable)){const s=this.numberOfMonths??1,r=ze(new Date,this._currentDate,s),l=this.value?.some(u=>ze(new Date(u.start),this._currentDate,s))??!1;if(!r&&!l){const u=a.find(p=>p.isCurrentMonth&&!p.isDisabled);u&&(u.isFocusable=!0)}}return a}checkDateStatus(e){let t=!1,i=!1,n=!1,a=!1;if(this._isSelecting&&this._nextDate&&this._anchorDate){const s=this._nextDate.date,r=new Date(this._anchorDate);s.getTime()>r.getTime()?a=e.getTime()>=r.getTime()&&e.getTime()<=s.getTime():a=e.getTime()>=s.getTime()&&e.getTime()<=r.getTime()}if(this.value&&Array.isArray(this.value))for(const s of this.value){const r=new Date(s.start);if(at(e,r)&&(t=!0,i=!s.end),s.end){const l=new Date(s.end);at(e,l)&&(i=!0);const u=e.getTime(),p=r.getTime(),c=l.getTime();u>p&&u<c&&(n=!0)}}return{isRangeStart:t,isRangeEnd:i,isInRange:n,isSelecting:a}}selectDate(e,t=null){if(!e.isCurrentMonth||this.disabled||this.readOnly)return;const i=e.date;if(!this._anchorDate){this._isSelecting=!0,this._anchorDate=i;return}let n=this._anchorDate,a=i;i<n&&(n=i,a=this._anchorDate);const s=this.calculateValidRanges(n,a),r=[...this.value||[],...s];this._skipValueNavigation=!0,this.value=Aa(r),this._isSelecting=!1,this._nextDate=null,this._anchorDate=null,this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}calculateValidRanges(e,t){const i=[],n=new Date(e),a=new Date(t);n.setHours(0,0,0,0),a.setHours(0,0,0,0);let s=null;for(;n<=a;){if(!this.isDisabled(n))s||(s=new Date(n));else if(s){const l=new Date(n);l.setDate(n.getDate()-1),i.push(si(s,l)),s=null}n.setDate(n.getDate()+1)}return s&&i.push(si(s,t)),i}onMouseOver(e){this._isSelecting&&(this._nextDate=e)}updated(){this.hidePills||this.setupObservers()}disconnectedCallback(){super.disconnectedCallback(),this.disconnectObservers()}renderAboveCalendar(){if(this.hidePills)return d.nothing;const e=this.getSortedPills();return e.length===0?d.nothing:d.html`
|
|
229
|
+
<div
|
|
230
|
+
class=${$.classMap({"gui-range-calendar__pills-wrapper":!0,"gui-range-calendar--start-shadow":!this._isStartVisible,"gui-range-calendar--end-shadow":!this._isEndVisible})}
|
|
231
|
+
>
|
|
232
|
+
<div class="gui-range-calendar__pills" role="list">
|
|
233
|
+
<span class="gui-sentinel gui-sentinel__start"></span>
|
|
234
|
+
${Q.repeat(e,t=>`${t.start}-${t.end??t.start}`,(t,i)=>this.renderPill(t,i))}
|
|
235
|
+
<span class="gui-sentinel gui-sentinel__end"></span>
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
`}renderPill(e,t){const i=this.formatDateForDisplay(e.start),n=e.end?this.formatDateForDisplay(e.end):i,a=`${i} - ${n}`;return d.html`
|
|
239
|
+
<div
|
|
240
|
+
class="gui-range-calendar__pill"
|
|
241
|
+
role="listitem"
|
|
242
|
+
tabindex="0"
|
|
243
|
+
aria-label="${this.removePillAriaLabel??"Remove date"} ${a}"
|
|
244
|
+
@click=${()=>this.navigateToDate(e.start)}
|
|
245
|
+
@keydown=${s=>this.handlePillKeydown(s,t)}
|
|
246
|
+
>
|
|
247
|
+
<span class="gui-range-calendar__pill-text">${a}</span>
|
|
248
|
+
<button
|
|
249
|
+
type="button"
|
|
250
|
+
class="gui-range-calendar__pill-remove"
|
|
251
|
+
tabindex="-1"
|
|
252
|
+
?disabled=${this.disabled||this.readOnly}
|
|
253
|
+
@click=${s=>{s.stopPropagation(),this.removePill(t)}}
|
|
254
|
+
>
|
|
255
|
+
<svg
|
|
256
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
257
|
+
width="16"
|
|
258
|
+
height="16"
|
|
259
|
+
viewBox="0 0 256 256"
|
|
260
|
+
fill="currentColor"
|
|
261
|
+
aria-hidden="true"
|
|
262
|
+
>
|
|
263
|
+
<path
|
|
264
|
+
d="M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"
|
|
265
|
+
></path>
|
|
266
|
+
</svg>
|
|
267
|
+
</button>
|
|
268
|
+
</div>
|
|
269
|
+
`}formatDateForDisplay(e){const t=new Date(e);return isNaN(t.getTime())?e:new Intl.DateTimeFormat(this.localeId??"en",{year:"numeric",month:"2-digit",day:"2-digit"}).format(t)}getSortedPills(){return!this.value||!Array.isArray(this.value)?[]:[...this.value].sort((e,t)=>new Date(e.start).getTime()-new Date(t.start).getTime())}removePill(e){if(this.disabled||this.readOnly)return;const t=this.getSortedPills();t.splice(e,1),this.value=[...t],this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0}))}handlePillKeydown(e,t){if(e.key==="Delete"||e.key==="Backspace"){e.preventDefault(),this.removePill(t);return}if(e.key==="Enter"){e.preventDefault();const i=this.getSortedPills();i[t]&&this.navigateToDate(i[t].start);return}if(e.key==="ArrowLeft"||e.key==="ArrowRight"){e.preventDefault();const i=this.querySelectorAll(".gui-range-calendar__pills .gui-range-calendar__pill"),n=e.key==="ArrowLeft"?t-1:t+1;n>=0&&n<i.length&&i[n].focus()}}navigateToDate(e){const t=new Date(e);!isNaN(t.getTime())&&!ze(t,this._currentDate,this.numberOfMonths??1)&&(this._currentDate=t)}setupObservers(){const e=this.querySelector(".gui-sentinel__start"),t=this.querySelector(".gui-sentinel__end");e&&!this.startObserver&&(this.startObserver=Ye(e,i=>this._isStartVisible=i)),t&&!this.endObserver&&(this.endObserver=Ye(t,i=>this._isEndVisible=i)),!e&&this.startObserver&&(this.startObserver.disconnect(),this.startObserver=void 0,this._isStartVisible=!0),!t&&this.endObserver&&(this.endObserver.disconnect(),this.endObserver=void 0,this._isEndVisible=!0)}disconnectObservers(){this.startObserver?.disconnect(),this.endObserver?.disconnect(),this.startObserver=void 0,this.endObserver=void 0}};ke([o.property({type:Array})],ge.prototype,"value",2),ke([o.property({type:String})],ge.prototype,"focusDate",2),ke([o.property({type:Boolean})],ge.prototype,"hidePills",2),ke([o.property({type:String})],ge.prototype,"removePillAriaLabel",2),ke([o.state()],ge.prototype,"_anchorDate",2),ke([o.state()],ge.prototype,"_nextDate",2),ke([o.state()],ge.prototype,"_isSelecting",2),ke([o.state()],ge.prototype,"_isStartVisible",2),ke([o.state()],ge.prototype,"_isEndVisible",2),ge=ke([o.customElement("gui-range-calendar")],ge),typeof customElements<"u"&&!customElements.get("gui-range-calendar")&&customElements.define("gui-range-calendar",ge);var Fl=Object.defineProperty,Rl=Object.getOwnPropertyDescriptor,oi=(e,t,i,n)=>{for(var a=n>1?void 0:n?Rl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Fl(t,i,a),a};let st=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-calendar","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
47
270
|
<gui-range-calendar
|
|
48
271
|
.uid=${this.widget.uid}
|
|
49
272
|
.label=${this.adapter.templateData.label}
|
|
@@ -71,7 +294,120 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
71
294
|
@change=${this.valueChanged}
|
|
72
295
|
@blur=${()=>this.adapter.onBlur()}
|
|
73
296
|
></gui-range-calendar>
|
|
74
|
-
`}valueChanged(e){const t=e?.target;this.adapter.valueChanged(t.value)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
297
|
+
`}valueChanged(e){const t=e?.target;this.adapter.valueChanged(t.value)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};oi([D.consume({context:y.formContext}),o.property({attribute:!1})],st.prototype,"formContext",2),oi([D.provide({context:y.inputContext})],st.prototype,"adapter",2),st=oi([o.customElement("gui-range-calendar-input")],st);const Nl=Object.freeze(Object.defineProperty({__proto__:null,get RangeCalendarElement(){return st}},Symbol.toStringTag,{value:"Module"}));var ql=Object.defineProperty,Bl=Object.getOwnPropertyDescriptor,I=(e,t,i,n)=>{for(var a=n>1?void 0:n?Bl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&ql(t,i,a),a};let x=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.localeId=void 0,this.errors=[],this.showErrors=!0,this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=[],this.hint=void 0,this.icon="",this.removePillAriaLabel=void 0,this.startDateAriaLabel=void 0,this.endDateAriaLabel=void 0,this.separator=void 0,this._startDate={day:"",month:"",year:""},this._endDate={day:"",month:"",year:""},this._isStartVisible=!0,this._isEndVisible=!0,this._showPillsList=!1,this.MIN_DAY=1,this.MAX_DAY=31,this.MAX_VALID_DAY=(e,t)=>e===2?new Date(t,1,29).getDate()===29||!t?29:28:e===4||e===6||e===9||e===11?30:31,this.MIN_MONTH=1,this.MAX_MONTH=12,this.MIN_YEAR=1e3,this.MAX_YEAR=9999,this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(".gui-range-date-input"),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,readonly:this.readOnly,disabled:this.disabled,touched:this.touched}})}),this.handleOutsideInteraction=e=>{const t=this.querySelector(".gui-range-date-input__pills-compact"),i=this.querySelector(".gui-range-date-input__pills-dropdown"),n=e.composedPath()[0];!t?.contains(n)&&!i?.contains(n)&&(this._showPillsList=!1,this.removeOutsideListeners())}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}updated(){this.setupObservers()}disconnectedCallback(){super.disconnectedCallback(),this.disconnectObservers(),this.removeOutsideListeners()}render(){const e={uid:this.uid,label:this.label,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,hint:this.hint},t=new Intl.DateTimeFormat(this.localeId??"en",{year:"numeric",month:"numeric",day:"numeric"}).formatToParts(new Date),i=this.getSortedPills(),n={"gui-widget-icon":!0,[this.icon]:!!this.icon};return d.html`
|
|
298
|
+
${this.label?le(this.uid,e,!1,void 0,!1):d.nothing}
|
|
299
|
+
|
|
300
|
+
<div class="gui-widget">
|
|
301
|
+
<div
|
|
302
|
+
class="gui-range-date-input ${this.icon?"gui-range-date-input--icon":""}"
|
|
303
|
+
role="group"
|
|
304
|
+
aria-label=${this.label??"Date range input"}
|
|
305
|
+
>
|
|
306
|
+
${this.icon?d.html`<span class=${$.classMap(n)} data-icon=${this.icon}></span>`:d.nothing}
|
|
307
|
+
${i.length>0?d.html`<div
|
|
308
|
+
class=${$.classMap({"gui-range-date-input__pills-wrapper":!0,"gui-range-date-input--start-shadow":!this._isStartVisible,"gui-range-date-input--end-shadow":!this._isEndVisible})}
|
|
309
|
+
>
|
|
310
|
+
<div class="gui-range-date-input__pills" role="list">
|
|
311
|
+
<span class="gui-sentinel gui-sentinel__start"></span>
|
|
312
|
+
${Q.repeat(i,a=>`${a.start}-${a.end??a.start}`,(a,s)=>this.renderPill(a,s))}
|
|
313
|
+
<span class="gui-sentinel gui-sentinel__end"></span>
|
|
314
|
+
</div>
|
|
315
|
+
</div>
|
|
316
|
+
<div class="gui-range-date-input__pills-compact">
|
|
317
|
+
<button
|
|
318
|
+
type="button"
|
|
319
|
+
tabindex="0"
|
|
320
|
+
class="gui-range-date-input__pill--count"
|
|
321
|
+
aria-label="${i.length} date ranges"
|
|
322
|
+
@click=${this.togglePillsList}
|
|
323
|
+
>
|
|
324
|
+
${i.length}
|
|
325
|
+
</button>
|
|
326
|
+
</div>`:d.nothing}
|
|
327
|
+
|
|
328
|
+
<div class="gui-range-date-input__inputs">
|
|
329
|
+
<div
|
|
330
|
+
class="gui-range-date-input__field"
|
|
331
|
+
role="group"
|
|
332
|
+
aria-label=${this.startDateAriaLabel??"Start date"}
|
|
333
|
+
>
|
|
334
|
+
${this.renderDateInputs("start",t)}
|
|
335
|
+
</div>
|
|
336
|
+
|
|
337
|
+
<span class="gui-range-date-input__separator">${this.separator??"-"}</span>
|
|
338
|
+
|
|
339
|
+
<div
|
|
340
|
+
class="gui-range-date-input__field"
|
|
341
|
+
role="group"
|
|
342
|
+
aria-label=${this.endDateAriaLabel??"End date"}
|
|
343
|
+
>
|
|
344
|
+
${this.renderDateInputs("end",t)}
|
|
345
|
+
</div>
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
${this._showPillsList&&i.length>0?d.html`<div class="gui-range-date-input__pills-dropdown" role="list">
|
|
349
|
+
${Q.repeat(i,a=>`${a.start}-${a.end??a.start}`,(a,s)=>this.renderPill(a,s))}
|
|
350
|
+
</div>`:d.nothing}
|
|
351
|
+
</div>
|
|
352
|
+
|
|
353
|
+
${this.showErrors&&this.errors?.length?V(this.uid,e):d.nothing}
|
|
354
|
+
`}renderPill(e,t){const i=this.formatDateForDisplay(e.start),n=e.end?this.formatDateForDisplay(e.end):i,a=`${i} - ${n}`;return d.html`
|
|
355
|
+
<div
|
|
356
|
+
class="gui-range-date-input__pill"
|
|
357
|
+
role="listitem"
|
|
358
|
+
tabindex="0"
|
|
359
|
+
aria-label="${this.removePillAriaLabel??"Remove date"} ${a}"
|
|
360
|
+
@click=${()=>this.onPillClick(e)}
|
|
361
|
+
@focus=${this.handlePillFocus}
|
|
362
|
+
@keydown=${s=>this.handlePillKeydown(s,t)}
|
|
363
|
+
>
|
|
364
|
+
<span class="gui-range-date-input__pill-text">${a}</span>
|
|
365
|
+
<button
|
|
366
|
+
type="button"
|
|
367
|
+
class="gui-range-date-input__pill-remove"
|
|
368
|
+
tabindex="-1"
|
|
369
|
+
?disabled=${this.disabled||this.readOnly}
|
|
370
|
+
@click=${()=>this.removePill(t)}
|
|
371
|
+
>
|
|
372
|
+
<svg
|
|
373
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
374
|
+
width="16"
|
|
375
|
+
height="16"
|
|
376
|
+
viewBox="0 0 256 256"
|
|
377
|
+
fill="currentColor"
|
|
378
|
+
aria-hidden="true"
|
|
379
|
+
>
|
|
380
|
+
<path
|
|
381
|
+
d="M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"
|
|
382
|
+
></path>
|
|
383
|
+
</svg>
|
|
384
|
+
</button>
|
|
385
|
+
</div>
|
|
386
|
+
`}renderDateInputs(e,t){const i=e==="start"?this._startDate:this._endDate;return Q.repeat(t,n=>`${e}-${n.type}`,(n,a)=>{const s=e==="start"&&a===0?0:-1;switch(n.type){case"day":return this.renderInput(e,"day","dd",2,s,i.day);case"month":return this.renderInput(e,"month","mm",2,s,i.month);case"year":return this.renderInput(e,"year","yyyy",4,s,i.year);case"literal":return d.html`<span class="gui-range-date-input__separator">${n.value}</span>`;default:return""}})}renderInput(e,t,i,n,a,s){return d.html`
|
|
387
|
+
<div class="gui-range-date-input__touch-target">
|
|
388
|
+
<input
|
|
389
|
+
type="text"
|
|
390
|
+
inputmode="numeric"
|
|
391
|
+
class="gui-range-date-input__part ${t==="year"?"gui-range-date-input__year":""}"
|
|
392
|
+
data-type=${t}
|
|
393
|
+
data-group=${e}
|
|
394
|
+
maxlength=${n}
|
|
395
|
+
placeholder=${i}
|
|
396
|
+
tabindex=${a}
|
|
397
|
+
?required=${this.required}
|
|
398
|
+
?disabled=${this.disabled}
|
|
399
|
+
?readonly=${this.readOnly}
|
|
400
|
+
autocomplete="off"
|
|
401
|
+
.value=${Ei.live(s)}
|
|
402
|
+
@keydown=${this.handleKeyDown}
|
|
403
|
+
@keyup=${r=>this.handleKeyUp(r,e,t)}
|
|
404
|
+
@focus=${this.handleFocus}
|
|
405
|
+
@blur=${r=>this.handleBlur(r,e,t)}
|
|
406
|
+
@change=${r=>this.handleChange(r,e,t)}
|
|
407
|
+
/>
|
|
408
|
+
<div class="gui-range-date-input__visual-underline"></div>
|
|
409
|
+
</div>
|
|
410
|
+
`}formatDateForDisplay(e){const t=new Date(e);return isNaN(t.getTime())?e:new Intl.DateTimeFormat(this.localeId??"en",{year:"numeric",month:"2-digit",day:"2-digit"}).format(t)}getSortedPills(){return!this.value||!Array.isArray(this.value)?[]:[...this.value].sort((e,t)=>new Date(e.start).getTime()-new Date(t.start).getTime())}togglePillsList(){this._showPillsList=!this._showPillsList,this._showPillsList?requestAnimationFrame(()=>{document.addEventListener("pointerdown",this.handleOutsideInteraction),document.addEventListener("focusin",this.handleOutsideInteraction),this.querySelector(".gui-range-date-input__pills-dropdown .gui-range-date-input__pill")?.focus()}):this.removeOutsideListeners()}removeOutsideListeners(){document.removeEventListener("pointerdown",this.handleOutsideInteraction),document.removeEventListener("focusin",this.handleOutsideInteraction)}removePill(e){if(this.disabled||this.readOnly)return;const t=this.getSortedPills();t.splice(e,1),this.value=[...t],this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})),this._showPillsList&&t.length===0&&(this._showPillsList=!1,this.removeOutsideListeners()),requestAnimationFrame(()=>{const i=this._showPillsList?".gui-range-date-input__pills-dropdown .gui-range-date-input__pill":".gui-range-date-input__pills .gui-range-date-input__pill",n=this.querySelectorAll(i);if(n.length>0){const a=Math.min(e,n.length-1);n[a].focus()}else this.querySelector(".gui-range-date-input__field input")?.focus()})}handlePillFocus(e){e.target.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}handlePillKeydown(e,t){if(e.key==="Delete"||e.key==="Backspace"){e.preventDefault(),e.stopPropagation(),this.removePill(t);return}if(e.key==="Enter"||e.key===" "){e.preventDefault();const s=this.getSortedPills();s[t]&&this.onPillClick(s[t]);return}const i=this._showPillsList,n=i?"ArrowUp":"ArrowLeft",a=i?"ArrowDown":"ArrowRight";if(e.key===n||e.key===a){e.preventDefault();const s=i?".gui-range-date-input__pills-dropdown .gui-range-date-input__pill":".gui-range-date-input__pills .gui-range-date-input__pill",r=this.querySelectorAll(s),l=e.key===n?t-1:t+1;l>=0&&l<r.length&&r[l].focus()}}onPillClick(e){this.dispatchEvent(new CustomEvent("pillClick",{detail:{range:e},bubbles:!0,composed:!0}))}handleKeyDown(e){["Backspace","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Delete","Enter"].includes(e.key)||e.ctrlKey||e.metaKey||this.readOnly||/^[0-9]$/.test(e.key)||e.preventDefault()}handleFocus(e){this.dispatchEvent(new CustomEvent("focus",{detail:e}))}handleKeyUp(e,t,i){if(this.readOnly)return;const n=window.getComputedStyle(this).direction==="rtl",a=e.target,s=this.getGroupInputs(t),r=s.indexOf(a);if(a.value.length===a.maxLength&&/^[0-9]$/.test(e.key))if(r===s.length-1){if(t==="start"){const l=this.getGroupInputs("end");l.length>0&&l[0].focus()}}else s[r+1].focus();switch(e.key){case"Enter":{if(this.tryCreatePill(),this.value&&this.value.length>0){const l=this.value[this.value.length-1];this.onPillClick(l)}break}case"ArrowUp":{const l=isNaN(parseInt(a.value,10)+1)?1:parseInt(a.value,10)+1;this.setDatePartValue(t,i,l),a.select(),this.tryCreatePill();break}case"ArrowDown":{const l=isNaN(parseInt(a.value,10)-1)?1:parseInt(a.value,10)-1;this.setDatePartValue(t,i,l),a.select(),this.tryCreatePill();break}case"ArrowLeft":{const l=n?r+1:r-1;if(l>=0&&l<s.length)s[l].focus(),s[l].select();else{const u=n?"end":"start";if(t!==u){const p=this.getGroupInputs(u);if(p.length>0){const c=p[p.length-1];c.focus(),c.select()}}}break}case"ArrowRight":{const l=n?r-1:r+1;if(l>=0&&l<s.length)s[l].focus(),s[l].select();else{const u=n?"start":"end";if(t!==u){const p=this.getGroupInputs(u);p.length>0&&(p[0].focus(),p[0].select())}}break}}}handleChange(e,t,i){if(e.stopImmediatePropagation(),this.readOnly)return;const a=e.target.value.replace(/[^0-9]/g,"");this.updateDatePart(t,i,a),this.tryCreatePill()}handleBlur(e,t,i){const n=e.target,a=parseInt(n.value,10);if(!isNaN(a)&&a>0){const s=i==="year"?4:2;n.value=a.toString().padStart(s,"0")}this.dispatchEvent(new CustomEvent("blur"))}getGroupInputs(e){return Array.from(this.querySelectorAll(`input[data-group="${e}"]`))}setDatePartValue(e,t,i){const n=e==="start"?this._startDate:this._endDate,a=t==="year"?4:2;t==="day"&&(n.day=i.toString().padStart(a,"0")),t==="month"&&(n.month=i.toString().padStart(a,"0")),t==="year"&&(n.year=i.toString().padStart(a,"0")),e==="start"?this._startDate={...n}:this._endDate={...n}}updateDatePart(e,t,i){e==="start"?this._startDate={...this._startDate,[t]:i}:this._endDate={...this._endDate,[t]:i}}validateDateParts(e){let t=parseInt(e.year,10),i=parseInt(e.month,10),n=parseInt(e.day,10);if(isNaN(t)||isNaN(i)||isNaN(n)||String(t).length<4)return null;t=Math.max(this.MIN_YEAR,Math.min(this.MAX_YEAR,t)),i=Math.max(this.MIN_MONTH,Math.min(this.MAX_MONTH,i)),n=Math.max(this.MIN_DAY,Math.min(this.MAX_DAY,n));const a=this.MAX_VALID_DAY(i,t);return n>a?(this.dispatchEvent(new CustomEvent("inputError",{detail:{message:"Invalid date: day is greater than the maximum valid day for the month and year."},bubbles:!0})),null):new Date(t,i-1,n)}setupObservers(){const e=this.querySelector(".gui-sentinel__start"),t=this.querySelector(".gui-sentinel__end");e&&!this.startObserver&&(this.startObserver=Ye(e,i=>this._isStartVisible=i)),t&&!this.endObserver&&(this.endObserver=Ye(t,i=>this._isEndVisible=i)),!e&&this.startObserver&&(this.startObserver.disconnect(),this.startObserver=void 0,this._isStartVisible=!0),!t&&this.endObserver&&(this.endObserver.disconnect(),this.endObserver=void 0,this._isEndVisible=!0)}disconnectObservers(){this.startObserver?.disconnect(),this.endObserver?.disconnect(),this.startObserver=void 0,this.endObserver=void 0}tryCreatePill(){const e=this.validateDateParts(this._startDate),t=this.validateDateParts(this._endDate);if(!e||!t)return;let i=e,n=t;t.getTime()<e.getTime()&&(i=t,n=e);const a=Oe(i),s=Oe(n),r=a===s?{start:a}:{start:a,end:s},l=this.value?[...this.value]:[];l.push(r),this.value=Aa(l),this._startDate={day:"",month:"",year:""},this._endDate={day:"",month:"",year:""},this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0,composed:!0})),requestAnimationFrame(()=>{const u=this.getGroupInputs("start");u.length>0&&u[0].focus()}),this.requestUpdate()}};I([o.property({type:String})],x.prototype,"uid",2),I([o.property({type:String})],x.prototype,"label",2),I([o.property({type:String,attribute:"locale-id"})],x.prototype,"localeId",2),I([o.property({type:Array})],x.prototype,"errors",2),I([o.property({type:Boolean})],x.prototype,"showErrors",2),I([o.property({type:Boolean})],x.prototype,"touched",2),I([o.property({type:Boolean})],x.prototype,"required",2),I([o.property({type:Boolean})],x.prototype,"disabled",2),I([o.property({type:Boolean,attribute:"readonly"})],x.prototype,"readOnly",2),I([o.property({type:Array})],x.prototype,"value",2),I([o.property({type:String})],x.prototype,"hint",2),I([o.property({type:String})],x.prototype,"icon",2),I([o.property({type:String})],x.prototype,"removePillAriaLabel",2),I([o.property({type:String})],x.prototype,"startDateAriaLabel",2),I([o.property({type:String})],x.prototype,"endDateAriaLabel",2),I([o.property({type:String})],x.prototype,"separator",2),I([o.state()],x.prototype,"_startDate",2),I([o.state()],x.prototype,"_endDate",2),I([o.state()],x.prototype,"_isStartVisible",2),I([o.state()],x.prototype,"_isEndVisible",2),I([o.state()],x.prototype,"_showPillsList",2),x=I([o.customElement("gui-range-date")],x),typeof customElements<"u"&&!customElements.get("gui-range-date")&&customElements.define("gui-range-date",x);var Zl=Object.defineProperty,Vl=Object.getOwnPropertyDescriptor,li=(e,t,i,n)=>{for(var a=n>1?void 0:n?Vl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Zl(t,i,a),a};let rt=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-range-date","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
75
411
|
<gui-range-date
|
|
76
412
|
.uid=${this.widget.uid}
|
|
77
413
|
.label=${this.adapter.templateData.label}
|
|
@@ -91,7 +427,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
91
427
|
@change=${this.valueChanged}
|
|
92
428
|
@inputError=${this.onInputError}
|
|
93
429
|
></gui-range-date>
|
|
94
|
-
`}valueChanged(e){this.adapter.injectValidationIssues(null),this.adapter.valueChanged(e.detail.value)}onInputError(e){this.adapter.injectValidationIssues([e.detail.message])}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
430
|
+
`}valueChanged(e){this.adapter.injectValidationIssues(null),this.adapter.valueChanged(e.detail.value)}onInputError(e){this.adapter.injectValidationIssues([e.detail.message])}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};li([D.consume({context:y.formContext}),o.property({attribute:!1})],rt.prototype,"formContext",2),li([D.provide({context:y.inputContext})],rt.prototype,"adapter",2),rt=li([o.customElement("gui-range-date-input")],rt);const Ul=Object.freeze(Object.defineProperty({__proto__:null,get RangeDateInputElement(){return rt}},Symbol.toStringTag,{value:"Module"}));var Wl=Object.defineProperty,Gl=Object.getOwnPropertyDescriptor,Re=(e,t,i,n)=>{for(var a=n>1?void 0:n?Gl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Wl(t,i,a),a};let xe=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.isCalendarOpen=!1,this.focusDate=void 0,this.subscriptions=[],this.onFocusOut=e=>{if(!this.isCalendarOpen)return;const t=e.relatedTarget;t&&this.contains(t)||this.closeCalendar()},this.onDocumentClick=e=>{if(!this.isCalendarOpen)return;const t=e.composedPath(),i=this.dateInput&&t.includes(this.dateInput),n=this.calendarInput&&t.includes(this.calendarInput);!i&&!n&&this.closeCalendar()}}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.onDocumentClick),this.addEventListener("focusout",this.onFocusOut),this.classList.add("gui-range-date-picker","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){super.render();const e=Fe("datePicker",this.adapter.templateData),t=this.isCalendarOpen?d.html`<gui-range-calendar
|
|
95
431
|
id="calendar-input"
|
|
96
432
|
.uid=${this.widget.uid}
|
|
97
433
|
.hint=${this.adapter.templateData.hint}
|
|
@@ -116,20 +452,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
116
452
|
.hidePills=${!0}
|
|
117
453
|
@blur=${this.onBlurCalendar}
|
|
118
454
|
@change=${this.valueChanged}
|
|
119
|
-
></gui-range-calendar>`:
|
|
120
|
-
${
|
|
455
|
+
></gui-range-calendar>`:d.nothing;return d.html`
|
|
456
|
+
${le(this.widget.uid,{...this.adapter.templateData,required:this.adapter.templateData.validator?.required})}
|
|
121
457
|
|
|
122
458
|
<div
|
|
123
459
|
role="button"
|
|
124
460
|
tabindex="-1"
|
|
125
461
|
class="gui-widget"
|
|
126
462
|
aria-expanded=${this.isCalendarOpen}
|
|
127
|
-
@keyup=${
|
|
128
|
-
@click=${
|
|
463
|
+
@keyup=${i=>this.onKeyUp(i)}
|
|
464
|
+
@click=${i=>this.toggleCalendar(i)}
|
|
129
465
|
>
|
|
130
466
|
<gui-range-date
|
|
131
467
|
id="date-input"
|
|
132
|
-
class=${
|
|
468
|
+
class=${$.classMap(e.widgetClasses)}
|
|
133
469
|
.uid=${this.widget.uid}
|
|
134
470
|
.hint=${this.adapter.templateData.hint}
|
|
135
471
|
.showErrors=${!1}
|
|
@@ -161,8 +497,38 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
161
497
|
${t}
|
|
162
498
|
</div>
|
|
163
499
|
|
|
164
|
-
${
|
|
165
|
-
`}valueChanged(e){this.adapter.injectValidationIssues(null),this.adapter.valueChanged(e.detail.value)}onBlurCalendar(){this.adapter.onBlur(),this.closeCalendar()}onInputError(e){this.adapter.injectValidationIssues([e.detail.message])}onPillClick(e){this.focusDate=e.detail.range.start,this.openCalendar()}onKeyUp(e){const t=e;t.target===t.currentTarget&&(t?.key==="Enter"||t?.key===" ")&&(this.isCalendarOpen=!this.isCalendarOpen,this.requestUpdate())}toggleCalendar(e){const t=e.target,
|
|
500
|
+
${V(this.widget.uid,this.adapter.templateData)}
|
|
501
|
+
`}valueChanged(e){this.adapter.injectValidationIssues(null),this.adapter.valueChanged(e.detail.value)}onBlurCalendar(){this.adapter.onBlur(),this.closeCalendar()}onInputError(e){this.adapter.injectValidationIssues([e.detail.message])}onPillClick(e){this.focusDate=e.detail.range.start,this.openCalendar()}onKeyUp(e){const t=e;t.target===t.currentTarget&&(t?.key==="Enter"||t?.key===" ")&&(this.isCalendarOpen=!this.isCalendarOpen,this.requestUpdate())}toggleCalendar(e){const t=e.target,i=t.closest(".gui-range-date-input__part"),n=t.closest("gui-range-calendar"),a=t.closest(".gui-range-date-input__pill"),s=t.closest(".gui-range-date-input__pill--count");i||n||a?this.openCalendar():s?this.closeCalendar():(this.isCalendarOpen=!this.isCalendarOpen,this.requestUpdate())}openCalendar(){this.isCalendarOpen||(this.isCalendarOpen=!0,this.requestUpdate())}closeCalendar(){this.isCalendarOpen=!1,this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.onDocumentClick),this.removeEventListener("focusout",this.onFocusOut),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};Re([D.consume({context:y.formContext}),o.property({attribute:!1})],xe.prototype,"formContext",2),Re([D.provide({context:y.inputContext})],xe.prototype,"adapter",2),Re([o.query("#date-input")],xe.prototype,"dateInput",2),Re([o.query("#calendar-input")],xe.prototype,"calendarInput",2),Re([o.state()],xe.prototype,"isCalendarOpen",2),Re([o.state()],xe.prototype,"focusDate",2),xe=Re([o.customElement("gui-range-date-picker-input")],xe);const Hl=Object.freeze(Object.defineProperty({__proto__:null,get RangeDatePickerElement(){return xe}},Symbol.toStringTag,{value:"Module"}));var Yl=Object.defineProperty,Kl=Object.getOwnPropertyDescriptor,M=(e,t,i,n)=>{for(var a=n>1?void 0:n?Kl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Yl(t,i,a),a};let A=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.localeId=void 0,this.errors=[],this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.currency=void 0,this.step=void 0,this.maximumFractionDigits=void 0,this.minimumFractionDigits=void 0,this.hint=void 0,this.icon=void 0,this.placeholder=void 0,this.autocomplete=void 0,this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(`input[id="${this.uid}"]`),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,readonly:this.readOnly,disabled:this.disabled,touched:this.touched}})})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}willUpdate(e){e.has("value")&&document.activeElement!==this.inputElement&&(this.displayValue=this.formatCurrency(this.value))}render(){super.render();const e={uid:this.uid,label:this.label,hint:this.hint,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,currency:this.currency,maximumFractionDigits:this.maximumFractionDigits,minimumFractionDigits:this.minimumFractionDigits,icon:this.icon,placeholder:this.placeholder,autocomplete:this.autocomplete};this.displayValue=this.formatCurrency(this.value);const t=Fe("currency",e),i={"gui-currency--icon":!!this.icon};return d.html`
|
|
502
|
+
${le(this.uid,e)}
|
|
503
|
+
|
|
504
|
+
<div class="gui-widget">
|
|
505
|
+
<input
|
|
506
|
+
type="number"
|
|
507
|
+
inputmode="decimal"
|
|
508
|
+
id=${this.uid}
|
|
509
|
+
data-cy=${`${this.uid}_currency`}
|
|
510
|
+
class=${$.classMap(i)}
|
|
511
|
+
step=${this.step&&this.step>0?this.step:d.nothing}
|
|
512
|
+
.value=${this.value??""}
|
|
513
|
+
?required=${this.disabled}
|
|
514
|
+
?disabled=${this.disabled}
|
|
515
|
+
?readonly=${this.readOnly}
|
|
516
|
+
placeholder=${this.placeholder||d.nothing}
|
|
517
|
+
autocomplete=${this.autocomplete||d.nothing}
|
|
518
|
+
@input=${this.handleInput}
|
|
519
|
+
@focus=${this.handleFocus}
|
|
520
|
+
@blur=${this.handleBlur}
|
|
521
|
+
/>
|
|
522
|
+
${this.displayValue?d.html`<label
|
|
523
|
+
for=${this.uid}
|
|
524
|
+
class="gui-currency__format-value ${this.icon?"gui-currency__format-value--icon":""}"
|
|
525
|
+
>${this.displayValue}</label
|
|
526
|
+
>`:d.nothing}
|
|
527
|
+
${t.html}
|
|
528
|
+
</div>
|
|
529
|
+
|
|
530
|
+
${V(this.uid,e)}
|
|
531
|
+
`}handleInput(e){if(e.stopPropagation(),!this.readOnly){const t=e.target;this.displayValue=this.formatCurrency(t.valueAsNumber),this.dispatchEvent(new CustomEvent("input",{detail:{value:t.valueAsNumber},bubbles:!0,composed:!0}))}}handleFocus(){this.displayValue=this.formatCurrency(this.value)}handleBlur(){this.displayValue=this.formatCurrency(this.value),this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0}))}formatCurrency(e){if(e===""||e===void 0||e===null||isNaN(e))return"";try{return new Intl.NumberFormat(this.localeId??"en",{style:"currency",currency:this.currency??"USD",maximumFractionDigits:this.maximumFractionDigits??Math.max(this.minimumFractionDigits??2,2),minimumFractionDigits:this.minimumFractionDigits??2}).format(e)}catch(t){return console.warn("Invalid locale or currency",t),e.toString()}}get separators(){const e=new Intl.NumberFormat(this.localeId??"en").format(1111.1);return{group:e.replace(/1/g,"").replace(/\d/g,"")[0]||",",decimal:e.replace(/1/g,"").replace(/\d/g,"").slice(-1)||"."}}};M([o.property({type:String})],A.prototype,"uid",2),M([o.property({type:String})],A.prototype,"label",2),M([o.property({type:String,attribute:"locale-id"})],A.prototype,"localeId",2),M([o.property({type:Array})],A.prototype,"errors",2),M([o.property({type:Boolean})],A.prototype,"touched",2),M([o.property({type:Boolean})],A.prototype,"required",2),M([o.property({type:Boolean})],A.prototype,"disabled",2),M([o.property({type:Boolean,attribute:"readonly"})],A.prototype,"readOnly",2),M([o.property({type:String})],A.prototype,"value",2),M([o.property({type:String})],A.prototype,"currency",2),M([o.property({type:String})],A.prototype,"step",2),M([o.property({type:String})],A.prototype,"maximumFractionDigits",2),M([o.property({type:String})],A.prototype,"minimumFractionDigits",2),M([o.property({type:String})],A.prototype,"hint",2),M([o.property({type:String})],A.prototype,"icon",2),M([o.property({type:String})],A.prototype,"placeholder",2),M([o.property({type:String})],A.prototype,"autocomplete",2),M([o.state()],A.prototype,"displayValue",2),M([o.query("input")],A.prototype,"inputElement",2),A=M([o.customElement("gui-currency")],A),typeof customElements<"u"&&!customElements.get("gui-currency")&&customElements.define("gui-currency",A);var Jl=Object.defineProperty,Xl=Object.getOwnPropertyDescriptor,di=(e,t,i,n)=>{for(var a=n>1?void 0:n?Xl(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Jl(t,i,a),a};let ot=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-currency","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
166
532
|
<gui-currency
|
|
167
533
|
.uid=${this.widget.uid}
|
|
168
534
|
.label=${this.adapter.templateData.label}
|
|
@@ -184,9 +550,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
184
550
|
@input=${this.valueChanged}
|
|
185
551
|
@blur=${()=>this.adapter.onBlur()}
|
|
186
552
|
></gui-currency>
|
|
187
|
-
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
553
|
+
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};di([D.consume({context:y.formContext}),o.property({attribute:!1})],ot.prototype,"formContext",2),di([D.provide({context:y.inputContext})],ot.prototype,"adapter",2),ot=di([o.customElement("gui-currency-input")],ot);const Ql=Object.freeze(Object.defineProperty({__proto__:null,get CurrencyElement(){return ot}},Symbol.toStringTag,{value:"Module"}));var jl=Object.defineProperty,ed=Object.getOwnPropertyDescriptor,j=(e,t,i,n)=>{for(var a=n>1?void 0:n?ed(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&jl(t,i,a),a};let U=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.localeId=void 0,this.errors=[],this.showErrors=!0,this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.icon="",this.hint=void 0,this._day="",this._month="",this._year="",this.MIN_DAY=1,this.MAX_DAY=31,this.MAX_VALID_DAY=(e,t)=>e===2?new Date(t,1,29).getDate()===29||!t?29:28:e===4||e===6||e===9||e===11?30:31,this.MIN_MONTH=1,this.MAX_MONTH=12,this.MIN_YEAR=1e3,this.MAX_YEAR=9999,this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(".gui-date-input"),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,readonly:this.readOnly,disabled:this.disabled,touched:this.touched}})})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}willUpdate(e){e.has("value")&&this.parseValue(this.value??"")}render(){const e={uid:this.uid,label:this.label,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,icon:this.icon,hint:this.hint},t=new Intl.DateTimeFormat(this.localeId??"en",{year:"numeric",month:"numeric",day:"numeric"}).formatToParts(new Date),i={"gui-widget-icon":!0,[this.icon]:!0};return d.html`
|
|
554
|
+
${this.label?le(this.uid,e):d.nothing}
|
|
555
|
+
|
|
556
|
+
<div class="gui-widget">
|
|
557
|
+
<div class="gui-date-input ${this.icon?"gui-calendar--icon":""}" role="group">
|
|
558
|
+
${Q.repeat(t,n=>n.type,(n,a)=>{const s=a===0?0:-1;switch(n.type){case"day":return this.renderInput("day","dd",2,s,this._day);case"month":return this.renderInput("month","mm",2,s,this._month);case"year":return this.renderInput("year","yyyy",4,s,this._year);case"literal":return d.html`<span class="gui-date-input__separator">${n.value}</span>`;default:return""}})}
|
|
559
|
+
</div>
|
|
560
|
+
${this.icon?d.html`<span class=${$.classMap(i)} data-icon=${this.icon}></span>`:d.nothing}
|
|
561
|
+
</div>
|
|
562
|
+
|
|
563
|
+
${this.showErrors&&this.errors?.length?V(this.uid,e):d.nothing}
|
|
564
|
+
`}renderInput(e,t,i,n,a){return d.html`
|
|
565
|
+
<div class="gui-date-input__touch-target">
|
|
566
|
+
<input
|
|
567
|
+
type="text"
|
|
568
|
+
inputmode="numeric"
|
|
569
|
+
class="gui-date-input__part ${e==="year"?"gui-date-input__year":""}"
|
|
570
|
+
data-type=${e}
|
|
571
|
+
maxlength=${i}
|
|
572
|
+
placeholder=${t}
|
|
573
|
+
tabindex=${n}
|
|
574
|
+
?required=${this.required}
|
|
575
|
+
?disabled=${this.disabled}
|
|
576
|
+
?readonly=${this.readOnly}
|
|
577
|
+
autocomplete="off"
|
|
578
|
+
.value=${Ei.live(a)}
|
|
579
|
+
@keydown=${this.handleKeyDown}
|
|
580
|
+
@keyup=${s=>this.handleKeyUp(s,e)}
|
|
581
|
+
@focus=${this.handleFocus}
|
|
582
|
+
@blur=${s=>this.handleBlur(s,e)}
|
|
583
|
+
@change=${s=>this.handleChange(s,e)}
|
|
584
|
+
/>
|
|
585
|
+
<div class="gui-date-input__visual-underline"></div>
|
|
586
|
+
</div>
|
|
587
|
+
`}parseValue(e){if(!e){this._day="",this._month="",this._year="";return}const t=new Date(e);isNaN(t.getTime())||(this._day=t.getDate().toString().padStart(2,"0"),this._month=(t.getMonth()+1).toString().padStart(2,"0"),this._year=t.getFullYear().toString())}handleKeyDown(e){["Backspace","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Delete","Enter"].includes(e.key)||e.ctrlKey||e.metaKey||this.readOnly||/^[0-9]$/.test(e.key)||e.preventDefault()}handleFocus(e){this.dispatchEvent(new CustomEvent("focus",{detail:e}))}handleKeyUp(e,t){if(this.readOnly)return;const i=window.getComputedStyle(this).direction==="rtl",n=e.target,a=Array.from(this.querySelectorAll("input")),s=a.indexOf(n);switch(n.value.length===n.maxLength&&/^[0-9]$/.test(e.key)&&(s===a.length-1?a[0].focus():a[s+1].focus()),e.key){case"ArrowUp":{const r=isNaN(parseInt(n.value,10)+1)?1:parseInt(n.value,10)+1;t==="year"&&(this._year=r.toString().padStart(4,"0")),t==="month"&&(this._month=r.toString().padStart(2,"0")),t==="day"&&(this._day=r.toString().padStart(2,"0")),n.select(),this.validateAndEmit();break}case"ArrowDown":{const r=isNaN(parseInt(n.value,10)-1)?1:parseInt(n.value,10)-1;t==="year"&&(this._year=r.toString().padStart(4,"0")),t==="month"&&(this._month=r.toString().padStart(2,"0")),t==="day"&&(this._day=r.toString().padStart(2,"0")),n.select(),this.validateAndEmit();break}case"ArrowLeft":{const r=i?s+1:s-1;r>=0&&r<a.length&&(a[r].focus(),a[r].select());break}case"ArrowRight":{const r=i?s-1:s+1;r>=0&&r<a.length&&(a[r].focus(),a[r].select());break}}}handleChange(e,t){if(e.stopImmediatePropagation(),this.readOnly)return;const n=e.target.value.replace(/[^0-9]/g,"");switch(t){case"day":this._day=n;break;case"month":this._month=n;break;case"year":this._year=n;break}this.validateAndEmit()}handleBlur(e,t){const i=e.target,n=parseInt(i.value,10);if(!isNaN(n)&&n>0){const a=t==="year"?4:2;i.value=n.toString().padStart(a,"0")}else this.dispatchEvent(new CustomEvent("change",{detail:{value:null}}));this.dispatchEvent(new CustomEvent("blur"))}validateAndEmit(){let e=parseInt(this._year,10),t=parseInt(this._month,10),i=parseInt(this._day,10);e>this.MAX_YEAR&&(e=this.MAX_YEAR,this._year=e.toString().padStart(4,"0")),e<this.MIN_YEAR&&(e=this.MIN_YEAR,this._year=e.toString().padStart(4,"0")),t>this.MAX_MONTH&&(t=this.MAX_MONTH,this._month=t.toString().padStart(2,"0")),t<this.MIN_MONTH&&(t=this.MIN_MONTH,this._month=t.toString().padStart(2,"0")),i>this.MAX_DAY&&(i=this.MAX_DAY,this._day=i.toString().padStart(2,"0")),i<this.MIN_DAY&&(i=this.MIN_DAY,this._day=i.toString().padStart(2,"0"));const n=!isNaN(e)&&String(e).length===4,a=!isNaN(t)&&t>0;if(!isNaN(i)&&i>0&&a&&n){const r=this.MAX_VALID_DAY(t,e);if(i>r)this.dispatchEvent(new CustomEvent("inputError",{detail:{message:"Invalid date: day is greater than the maximum valid day for the month and year."},bubbles:!0}));else{const l=new Date(e,t-1,i);this.value=Oe(l),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value},bubbles:!0}))}}this.requestUpdate()}};j([o.property({type:String})],U.prototype,"uid",2),j([o.property({type:String})],U.prototype,"label",2),j([o.property({type:String,attribute:"locale-id"})],U.prototype,"localeId",2),j([o.property({type:Array})],U.prototype,"errors",2),j([o.property({type:Boolean})],U.prototype,"showErrors",2),j([o.property({type:Boolean})],U.prototype,"touched",2),j([o.property({type:Boolean})],U.prototype,"required",2),j([o.property({type:Boolean})],U.prototype,"disabled",2),j([o.property({type:Boolean,attribute:"readonly"})],U.prototype,"readOnly",2),j([o.property({type:String})],U.prototype,"value",2),j([o.property({type:String})],U.prototype,"icon",2),j([o.property({type:String})],U.prototype,"hint",2),j([o.state()],U.prototype,"_day",2),j([o.state()],U.prototype,"_month",2),j([o.state()],U.prototype,"_year",2),U=j([o.customElement("gui-date")],U),typeof customElements<"u"&&!customElements.get("gui-date")&&customElements.define("gui-date",U);var td=Object.defineProperty,id=Object.getOwnPropertyDescriptor,ui=(e,t,i,n)=>{for(var a=n>1?void 0:n?id(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&td(t,i,a),a};let lt=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-date","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){super.render();const e=Fe("date",this.adapter.templateData);return d.html`
|
|
188
588
|
<gui-date
|
|
189
|
-
class=${
|
|
589
|
+
class=${$.classMap(e.widgetClasses)}
|
|
190
590
|
.uid=${this.widget.uid}
|
|
191
591
|
.label=${this.adapter.templateData.label}
|
|
192
592
|
.hint=${this.adapter.templateData.hint}
|
|
@@ -202,7 +602,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
202
602
|
@blur=${()=>this.adapter.onBlur()}
|
|
203
603
|
@change=${this.valueChanged}
|
|
204
604
|
></gui-date>
|
|
205
|
-
`}valueChanged(e){this.adapter.injectValidationIssues(null),this.adapter.valueChanged(e.detail.value)}onInputError(e){this.adapter.injectValidationIssues([e.detail.message])}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
605
|
+
`}valueChanged(e){this.adapter.injectValidationIssues(null),this.adapter.valueChanged(e.detail.value)}onInputError(e){this.adapter.injectValidationIssues([e.detail.message])}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};ui([D.consume({context:y.formContext}),o.property({attribute:!1})],lt.prototype,"formContext",2),ui([D.provide({context:y.inputContext})],lt.prototype,"adapter",2),lt=ui([o.customElement("gui-date-input")],lt);const ad=Object.freeze(Object.defineProperty({__proto__:null,get DateElement(){return lt}},Symbol.toStringTag,{value:"Module"}));var nd=Object.defineProperty,sd=Object.getOwnPropertyDescriptor,Ke=(e,t,i,n)=>{for(var a=n>1?void 0:n?sd(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&nd(t,i,a),a};let Ie=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.isCalendarOpen=!1,this.subscriptions=[],this.onFocusOut=e=>{if(!this.isCalendarOpen)return;const t=e.relatedTarget;t&&this.contains(t)||this.closeCalendar()},this.onDocumentClick=e=>{if(!this.isCalendarOpen)return;const t=e.composedPath(),i=this.dateInput&&t.includes(this.dateInput),n=this.calendarInput&&t.includes(this.calendarInput);!i&&!n&&this.closeCalendar()}}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.onDocumentClick),this.addEventListener("focusout",this.onFocusOut),this.classList.add("gui-date-picker","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){super.render();const e=Fe("datePicker",this.adapter.templateData),t=this.isCalendarOpen?d.html`<gui-calendar
|
|
206
606
|
id="calendar-input"
|
|
207
607
|
.uid=${this.widget.uid}
|
|
208
608
|
.hint=${this.adapter.templateData.hint}
|
|
@@ -225,20 +625,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
225
625
|
.localeId=${this.adapter.templateData.lang}
|
|
226
626
|
@blur=${this.onBlurCalendar}
|
|
227
627
|
@change=${this.valueChanged}
|
|
228
|
-
></gui-calendar>`:
|
|
229
|
-
${
|
|
628
|
+
></gui-calendar>`:d.nothing;return d.html`
|
|
629
|
+
${le(this.widget.uid,{...this.adapter.templateData,required:this.adapter.templateData.validator?.required})}
|
|
230
630
|
|
|
231
631
|
<div
|
|
232
632
|
role="button"
|
|
233
633
|
tabindex="-1"
|
|
234
634
|
class="gui-widget"
|
|
235
635
|
aria-expanded=${this.isCalendarOpen}
|
|
236
|
-
@keyup=${
|
|
237
|
-
@click=${
|
|
636
|
+
@keyup=${i=>this.onKeyUp(i)}
|
|
637
|
+
@click=${i=>this.toggleCalendar(i)}
|
|
238
638
|
>
|
|
239
639
|
<gui-date
|
|
240
640
|
id="date-input"
|
|
241
|
-
class=${
|
|
641
|
+
class=${$.classMap(e.widgetClasses)}
|
|
242
642
|
.uid=${this.widget.uid}
|
|
243
643
|
.hint=${this.adapter.templateData.hint}
|
|
244
644
|
.showErrors=${!1}
|
|
@@ -265,17 +665,46 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
265
665
|
${t}
|
|
266
666
|
</div>
|
|
267
667
|
|
|
268
|
-
${
|
|
269
|
-
`}valueChanged(e){this.adapter.injectValidationIssues(null),this.adapter.valueChanged(e.detail.value)}onBlurCalendar(){this.adapter.onBlur(),this.closeCalendar()}onInputError(e){this.adapter.injectValidationIssues([e.detail.message])}onKeyUp(e){const t=e;t.target===t.currentTarget&&(t?.key==="Enter"||t?.key===" ")&&(this.isCalendarOpen=!this.isCalendarOpen,this.requestUpdate())}toggleCalendar(e){const t=e.target,
|
|
668
|
+
${V(this.widget.uid,this.adapter.templateData)}
|
|
669
|
+
`}valueChanged(e){this.adapter.injectValidationIssues(null),this.adapter.valueChanged(e.detail.value)}onBlurCalendar(){this.adapter.onBlur(),this.closeCalendar()}onInputError(e){this.adapter.injectValidationIssues([e.detail.message])}onKeyUp(e){const t=e;t.target===t.currentTarget&&(t?.key==="Enter"||t?.key===" ")&&(this.isCalendarOpen=!this.isCalendarOpen,this.requestUpdate())}toggleCalendar(e){const t=e.target,i=t.closest(".gui-date-input__part"),n=t.closest("gui-calendar");i||n?this.openCalendar():(this.isCalendarOpen=!this.isCalendarOpen,this.requestUpdate())}openCalendar(){this.isCalendarOpen||(this.isCalendarOpen=!0,this.requestUpdate())}closeCalendar(){this.isCalendarOpen=!1,this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.onDocumentClick),this.removeEventListener("focusout",this.onFocusOut),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};Ke([D.consume({context:y.formContext}),o.property({attribute:!1})],Ie.prototype,"formContext",2),Ke([D.provide({context:y.inputContext})],Ie.prototype,"adapter",2),Ke([o.query("#date-input")],Ie.prototype,"dateInput",2),Ke([o.query("#calendar-input")],Ie.prototype,"calendarInput",2),Ke([o.state()],Ie.prototype,"isCalendarOpen",2),Ie=Ke([o.customElement("gui-date-picker-input")],Ie);const rd=Object.freeze(Object.defineProperty({__proto__:null,get DatePickerElement(){return Ie}},Symbol.toStringTag,{value:"Module"})),Ma=e=>{const t={"gui-list__item":!0,"gui-list__item-selected":!!e.selected,"gui-list__item-focused":!!e.focused,"gui-list__item-disabled":!!e.disabled};return d.html`
|
|
270
670
|
<div
|
|
271
671
|
role="option"
|
|
272
|
-
class=${
|
|
672
|
+
class=${$.classMap(t)}
|
|
273
673
|
aria-selected=${e.selected?"true":"false"}
|
|
274
674
|
aria-disabled=${e.disabled?"true":"false"}
|
|
275
675
|
>
|
|
276
676
|
${e.template}
|
|
277
677
|
</div>
|
|
278
|
-
`};var
|
|
678
|
+
`};var od=Object.defineProperty,ld=Object.getOwnPropertyDescriptor,we=(e,t,i,n)=>{for(var a=n>1?void 0:n?ld(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&od(t,i,a),a};let me=class extends d.LitElement{constructor(){super(...arguments),this.targetElement=void 0,this.uid=void 0,this.label=void 0,this.hint=void 0,this.required=void 0,this.errors=[],this.disabled=!1,this.readOnly=!1,this.touched=!1,this.native=!0,this.ariaController=new oe(this,{getTargets:()=>Array.isArray(this.targetElement)?[...this.targetElement]:[this.targetElement],getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,readonly:this.readOnly,disabled:this.disabled,touched:this.touched}})})}createRenderRoot(){return this}render(){return super.render(),d.html`${le(this.uid,{label:this.label,hint:this.hint,required:this.required,errors:this.errors,touched:this.touched},!1,void 0,this.native)}`}};we([o.property({type:Object})],me.prototype,"targetElement",2),we([o.property({type:String})],me.prototype,"uid",2),we([o.property({type:String})],me.prototype,"label",2),we([o.property({type:String})],me.prototype,"hint",2),we([o.property({type:Boolean})],me.prototype,"required",2),we([o.property({type:Array})],me.prototype,"errors",2),we([o.property({type:Boolean})],me.prototype,"disabled",2),we([o.property({type:Boolean,attribute:"readonly"})],me.prototype,"readOnly",2),we([o.property({type:Boolean})],me.prototype,"touched",2),we([o.property({type:Boolean})],me.prototype,"native",2),me=we([o.customElement("gui-label")],me),typeof customElements<"u"&&!customElements.get("gui-label")&&customElements.define("gui-label",me);const dd=e=>e!==null&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"template")&&Object.prototype.hasOwnProperty.call(e,"value");function ud(e){const t=typeof e;return t==="string"||t==="number"}const pd=(e,{valueField:t})=>{if(e===null||typeof e!="object")return!1;const i=e,n=t??"value";return!!Object.prototype.hasOwnProperty.call(i,n)};function cd(e,{valueField:t}){if(e===null||typeof e!="object")throw new Error("Provided value is not an object");const i=e,n=t??"value",a=Object.prototype.hasOwnProperty.call(i,n)?n:void 0;if(!a)throw new Error("No valueField exists on the object");return s=>{if(s===null||typeof s!="object")throw new Error("Item is not an object");return{template:s,value:a?s[a]:""}}}const hd=(e,t)=>{if(Array.isArray(e)&&e.length>0&&!dd(e[0])){if(ud(e[0]))return e.map(i=>({template:i,value:i}));if(pd(e[0],t)){const i=cd(e[0],t);return e.map(i)}else throw new Error("Invalid list item shape")}return e};var md=Object.defineProperty,yd=Object.getOwnPropertyDescriptor,W=(e,t,i,n)=>{for(var a=n>1?void 0:n?yd(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&md(t,i,a),a};let z=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.valueField=void 0,this.label=void 0,this.hint=void 0,this.items=[],this.itemHeight=void 0,this.height=void 0,this._items=[],this._scrollTop=0,this._viewportHeight=0,this._focusedIndex=-1,this.buffer=5}willUpdate(e){super.willUpdate(e),e.has("items")&&this.updateItems(),(e.has("items")||e.has("_scrollTop")||e.has("height"))&&this.emitRangeChange()}firstUpdated(){this.measureViewport(),new ResizeObserver(()=>this.measureViewport()).observe(this.viewportElement)}render(){const e=this.height??300,t=this.itemHeight??40,i=(this.items?.length??0)*t,{offsetY:n}=this.calculateRange(),a=this._focusedIndex>=0?`${this.uid}-item-${this._focusedIndex}`:void 0;return d.html`
|
|
679
|
+
<div
|
|
680
|
+
role="listbox"
|
|
681
|
+
id=${this.uid}
|
|
682
|
+
tabindex=${this.disabled?-1:0}
|
|
683
|
+
class="gui-list__scroll-viewport"
|
|
684
|
+
style="max-height: ${e}px; overflow-y: auto; position: relative; display: block;"
|
|
685
|
+
@scroll="${this.onScroll}"
|
|
686
|
+
@keydown="${this.onKeyDown}"
|
|
687
|
+
@focus="${this.onFocus}"
|
|
688
|
+
@focusout="${this.onFocusOut}"
|
|
689
|
+
aria-required=${this.required?"true":d.nothing}
|
|
690
|
+
aria-disabled=${this.disabled||this.readOnly?"true":d.nothing}
|
|
691
|
+
aria-activedescendant="${a??d.nothing}"
|
|
692
|
+
aria-label=${this.label??d.nothing}
|
|
693
|
+
aria-description=${this.hint??d.nothing}
|
|
694
|
+
>
|
|
695
|
+
<div
|
|
696
|
+
class="gui-list__spacer"
|
|
697
|
+
style="height: ${i}px; width: 1px; opacity: 0; pointer-events: none;"
|
|
698
|
+
></div>
|
|
699
|
+
|
|
700
|
+
<div
|
|
701
|
+
class="gui-list__content"
|
|
702
|
+
style="transform: translateY(${n}px); position: absolute; top: 0; left: 0; width: 100%;"
|
|
703
|
+
>
|
|
704
|
+
<slot></slot>
|
|
705
|
+
</div>
|
|
706
|
+
</div>
|
|
707
|
+
`}focus(e){this.viewportElement?this.viewportElement.focus(e):super.focus(e)}focusItemAtIndex(e){this._focusedIndex=e}scrollToSelectedIndex(){const e=this.items.findIndex(t=>(this.valueField?t[this.valueField]:t)===this.value);this.scrollToIndex(e)}onKeyDown(e){if(this.disabled||this.readOnly)return;const t=this.itemHeight??40,i=Math.ceil(this._viewportHeight/t),n=this.items.length-1;let a=!1;switch(e.key){case"ArrowDown":this.setFocusedIndex(Math.min(this._focusedIndex+1,n)),a=!0;break;case"ArrowUp":this.setFocusedIndex(Math.max(this._focusedIndex-1,0)),a=!0;break;case"PageDown":this.setFocusedIndex(Math.min(this._focusedIndex+i,n)),a=!0;break;case"PageUp":this.setFocusedIndex(Math.max(this._focusedIndex-i,0)),a=!0;break;case"Home":this.setFocusedIndex(0),a=!0;break;case"End":this.setFocusedIndex(n),a=!0;break;case"Enter":case" ":{const s=this.items[this._focusedIndex],r=s!=null;this._focusedIndex>=0&&r&&this.selectItem(this.items[this._focusedIndex]),a=!0;break}}a&&e.preventDefault()}onFocus(){if(!this.value||!this.items.length)return;const e=this.items.findIndex(t=>(this.valueField?t[this.valueField]:t)===this.value);this._focusedIndex=e,this.scrollToIndex(e),this.dispatchEvent(new CustomEvent("gui-focus-change",{detail:{index:e},bubbles:!0,composed:!0}))}onFocusOut(e){e.relatedTarget&&this.contains(e.relatedTarget)||(this._focusedIndex=-1,this.dispatchEvent(new CustomEvent("gui-focus-change",{detail:{index:-1},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0})))}scrollToIndex(e){const t=this.itemHeight??40,i=this.height??300,n=e*t,a=n+t,s=this.viewportElement.scrollTop,r=s+i;n<s?this.viewportElement.scrollTop=n:a>r&&(this.viewportElement.scrollTop=a-i)}selectItem(e){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.valueField?e[this.valueField]:e},bubbles:!0,composed:!0}))}setFocusedIndex(e){e<0||e>=this.items.length||(this._focusedIndex=e,this.scrollToIndex(e),this.dispatchEvent(new CustomEvent("gui-focus-change",{detail:{index:e},bubbles:!0,composed:!0})))}updateItems(){this._items=hd(this.items,{valueField:this.valueField}),this.dispatchEvent(new CustomEvent("gui-update-items",{detail:this._items,bubbles:!0,composed:!0}))}emitRangeChange(){const{startIndex:e,endIndex:t}=this.calculateRange();this.dispatchEvent(new CustomEvent("gui-range-change",{detail:{startIndex:e,endIndex:t},bubbles:!0,composed:!0}))}measureViewport(){this.viewportElement&&(this._viewportHeight=this.viewportElement.offsetHeight,this.emitRangeChange())}onScroll(e){const t=e.target;this._scrollTop=t.scrollTop}calculateRange(){const e=this.itemHeight??40,t=this.items?.length??0,i=Math.ceil(this._viewportHeight/e),n=Math.floor(this._scrollTop/e),a=Math.max(0,n-this.buffer),s=Math.min(t,n+i+this.buffer),r=a*e;return{startIndex:a,endIndex:s,offsetY:r}}};W([o.property({type:String})],z.prototype,"uid",2),W([o.property({type:Boolean})],z.prototype,"touched",2),W([o.property({type:Boolean})],z.prototype,"required",2),W([o.property({type:Boolean})],z.prototype,"disabled",2),W([o.property({type:Boolean,attribute:"readonly"})],z.prototype,"readOnly",2),W([o.property({type:String})],z.prototype,"value",2),W([o.property({type:String})],z.prototype,"valueField",2),W([o.property({type:String})],z.prototype,"label",2),W([o.property({type:String})],z.prototype,"hint",2),W([o.property({type:Array})],z.prototype,"items",2),W([o.property({type:Number})],z.prototype,"itemHeight",2),W([o.property({type:Number})],z.prototype,"height",2),W([o.state()],z.prototype,"_items",2),W([o.state()],z.prototype,"_scrollTop",2),W([o.state()],z.prototype,"_viewportHeight",2),W([o.state()],z.prototype,"_focusedIndex",2),W([o.query(".gui-list__scroll-viewport")],z.prototype,"viewportElement",2),z=W([o.customElement("gui-list")],z),typeof customElements<"u"&&!customElements.get("gui-list")&&customElements.define("gui-list",z);var fd=Object.defineProperty,gd=Object.getOwnPropertyDescriptor,Zt=(e,t,i,n)=>{for(var a=n>1?void 0:n?gd(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&fd(t,i,a),a};let Je=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.errors=[],this.touched=!1}createRenderRoot(){return this}render(){return super.render(),d.html`${V(this.uid,{touched:this.touched,errors:this.errors})}`}};Zt([o.property({type:String})],Je.prototype,"uid",2),Zt([o.property({type:Array})],Je.prototype,"errors",2),Zt([o.property({type:Boolean})],Je.prototype,"touched",2),Je=Zt([o.customElement("gui-errors")],Je),typeof customElements<"u"&&!customElements.get("gui-errors")&&customElements.define("gui-errors",Je);var Dd=Object.defineProperty,bd=Object.getOwnPropertyDescriptor,De=(e,t,i,n)=>{for(var a=n>1?void 0:n?bd(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Dd(t,i,a),a};let de=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.debouncer=new xi.Subject,this.subscriptions=[],this._range={start:0,end:10},this._filteredItems=[],this._listItems=[],this._focusedIndex=-1,this._isFiltering=!1,this._isListVisible=!1,this._selectedItem=void 0,this.onDocumentClick=e=>{if(!this._isListVisible)return;const t=e.composedPath(),i=this._inputRef&&t.includes(this._inputRef),n=this._listRef&&t.includes(this._listRef);!i&&!n&&(this._isListVisible=!1)}}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.onDocumentClick),this.classList.add("gui-dropdown","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this._filteredItems=this.adapter.templateData.items,this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>{const e=this.adapter.templateData;e.items&&this._listItems.length===0&&this._filteredItems.length===0&&(this._filteredItems=e.items,this._listItems=e.items),this.requestUpdate()}),this.debouncer.pipe(xi.debounceTime(this.adapter.templateData.inputDebounce??500)).subscribe(e=>{this._filterItems(e)}))}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}_onRangeChange(e){this._range={start:e.detail.startIndex,end:e.detail.endIndex}}_onUpdateItems(e){const t=e.detail||[];if(this._listItems=t,!this._selectedItem&&this.adapter.templateData.value!=null){const i=t.find(n=>n.value===this.adapter.templateData.value);i&&(this._selectedItem=i)}}_onFocusChange(e){this._focusedIndex=e.detail.index}_onClickItem(e,t){if(this.adapter.templateData.readonly)return;const i=this.adapter.templateData;this.adapter.valueChanged(e.value),this.adapter.filterChanged(""),this._focusedIndex=t,this._selectedItem=e,this._isFiltering=!1,this._isListVisible=!1,this._listRef&&(this._listRef.focusItemAtIndex(t),this._inputRef.value=i.valueField?e.template[i.valueField]:e.template)}_onValueChange(e){const t=e.detail.value;this.adapter.valueChanged(t),this.adapter.filterChanged(""),this._selectedItem=this._listItems.find(i=>i.value===t),this._isFiltering=!1,this._isListVisible=!1}async _onKeyDown(e){switch(e.key){case"ArrowDown":e.preventDefault(),this._isListVisible=!0,await this.updateComplete,this._listRef.focus(),this._listRef.scrollToSelectedIndex();break;case"Enter":this._inputRef.value||(this.adapter.valueChanged(null),this._isListVisible=!1,this._isFiltering=!1);break}}_onInput(e){const t=e.target.value;this.debouncer.next(t)}_filterItems(e){const t=this.adapter.templateData,i=!!this.widget.on?.filter;if(this.adapter.filterChanged(e),e&&!i){this._isFiltering=!0,this._isListVisible=!0;const n=t.searchFields??[t.labelField,t.valueField].filter(l=>!!l),a=n.length>0,r=(t.items||[]).filter(l=>{const u=Object.keys(l);if(!u.length)return l.toString().toLowerCase().includes(e.toLowerCase());const c=(h,f)=>h||l[f].toString().toLowerCase().includes(e.toLowerCase());return a?u.filter(h=>n.includes(h)).reduce(c,!1):u.reduce(c,!1)});this._filteredItems=[...r]}else this._isFiltering=!1,this._filteredItems=[...t.items]}async _onFocus(){this._isListVisible=!0,await this.updateComplete,this._listRef.scrollToSelectedIndex()}_onFocusOutInput(e){const t=e.relatedTarget;t&&this.contains(t)||(this.adapter.onBlur(),this._isListVisible=!1,this._isFiltering=!1)}_onBlur(){this.adapter.onBlur(),this._isListVisible=!1,this._isFiltering=!1}render(){const e=this.adapter.templateData,t=e.touched&&e.errors&&e.errors.length>0,i=this._listItems.slice(this._range.start,this._range.end),n=this.adapter.getItemRenderer(e.itemRenderer,Ma),s=this._selectedItem?.template!==null&&typeof this._selectedItem?.template=="object"?e.labelField??"label":null,r=s?this._selectedItem?.template[s]:this._selectedItem?.template,l=!!this.widget.on?.filter;return d.html`
|
|
279
708
|
<gui-label
|
|
280
709
|
.targetElement=${[this._listRef,this._inputRef]}
|
|
281
710
|
.uid=${this.widget.uid}
|
|
@@ -292,18 +721,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
292
721
|
type="text"
|
|
293
722
|
id=${this.widget.uid}
|
|
294
723
|
data-cy=${`${this.widget.uid}_textinput`}
|
|
295
|
-
.value=${
|
|
724
|
+
.value=${r??e.value??""}
|
|
296
725
|
?required=${e.validator?.required}
|
|
297
726
|
?disabled=${e.disabled}
|
|
298
727
|
?readonly=${e.readonly}
|
|
299
728
|
placeholder=${e.placeholder??""}
|
|
300
|
-
autocomplete=${e.autocomplete||
|
|
729
|
+
autocomplete=${e.autocomplete||d.nothing}
|
|
301
730
|
@keydown=${this._onKeyDown}
|
|
302
731
|
@input=${this._onInput}
|
|
303
732
|
@focusout=${this._onFocusOutInput}
|
|
304
733
|
@focus=${this._onFocus}
|
|
305
|
-
aria-labelledby=${e.label?`${this.widget.uid}_label`:
|
|
306
|
-
aria-describedby=${e.hint?`${this.widget.uid}_hint`:
|
|
734
|
+
aria-labelledby=${e.label?`${this.widget.uid}_label`:d.nothing}
|
|
735
|
+
aria-describedby=${e.hint?`${this.widget.uid}_hint`:d.nothing}
|
|
307
736
|
/>
|
|
308
737
|
<span class="gui-dropdown__arrow"
|
|
309
738
|
><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256">
|
|
@@ -317,7 +746,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
317
746
|
.uid=${this.widget.uid}
|
|
318
747
|
.value=${e.value??""}
|
|
319
748
|
.valueField=${e.valueField}
|
|
320
|
-
.items=${this._isFiltering&&!
|
|
749
|
+
.items=${this._isFiltering&&!l?this._filteredItems:e.items}
|
|
321
750
|
.itemHeight=${e.itemHeight}
|
|
322
751
|
.height=${e.height}
|
|
323
752
|
?required=${e.validator?.required}
|
|
@@ -332,28 +761,28 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
332
761
|
@blur=${this._onBlur}
|
|
333
762
|
@change=${this._onValueChange}
|
|
334
763
|
>
|
|
335
|
-
${
|
|
764
|
+
${i.map((u,p)=>{const c=this._range.start+p,h=e.value===u.value,f=this._focusedIndex===c,g=e.labelField??"label",T=u.template!==null&&typeof u.template=="object"&&g&&!e.itemRenderer?u.template[g]:u.template;return d.html`
|
|
336
765
|
<div
|
|
337
766
|
role="option"
|
|
338
767
|
tabindex="-1"
|
|
339
768
|
class="gui-list__item-wrapper"
|
|
340
|
-
id="${this.widget.uid}-item-${
|
|
769
|
+
id="${this.widget.uid}-item-${c}"
|
|
341
770
|
style="height: ${e.itemHeight||40}px"
|
|
342
|
-
aria-selected=${
|
|
343
|
-
@click=${()=>this._onClickItem(u,
|
|
771
|
+
aria-selected=${h?"true":"false"}
|
|
772
|
+
@click=${()=>this._onClickItem(u,c)}
|
|
344
773
|
>
|
|
345
|
-
${
|
|
774
|
+
${n({template:T,value:u.value,index:c,selected:h,disabled:!!e.disabled,focused:f})}
|
|
346
775
|
</div>
|
|
347
776
|
`})}
|
|
348
777
|
</gui-list>
|
|
349
778
|
</div>
|
|
350
779
|
|
|
351
|
-
${t?
|
|
780
|
+
${t?d.html`<gui-errors
|
|
352
781
|
.uid=${this.widget.uid}
|
|
353
782
|
.errors=${e.errors}
|
|
354
783
|
.touched=${e.touched}
|
|
355
|
-
></gui-errors>`:
|
|
356
|
-
`}};
|
|
784
|
+
></gui-errors>`:d.nothing}
|
|
785
|
+
`}};De([D.consume({context:y.formContext}),o.property({attribute:!1})],de.prototype,"formContext",2),De([D.provide({context:y.inputContext})],de.prototype,"adapter",2),De([o.state()],de.prototype,"_range",2),De([o.state()],de.prototype,"_filteredItems",2),De([o.state()],de.prototype,"_listItems",2),De([o.state()],de.prototype,"_focusedIndex",2),De([o.state()],de.prototype,"_isFiltering",2),De([o.state()],de.prototype,"_isListVisible",2),De([o.state()],de.prototype,"_selectedItem",2),De([o.query("input")],de.prototype,"_inputRef",2),De([o.query("gui-list")],de.prototype,"_listRef",2),de=De([o.customElement("gui-dropdown-input")],de);const vd=Object.freeze(Object.defineProperty({__proto__:null,get DropdownElement(){return de}},Symbol.toStringTag,{value:"Module"}));var wd=Object.defineProperty,$d=Object.getOwnPropertyDescriptor,Ne=(e,t,i,n)=>{for(var a=n>1?void 0:n?$d(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&wd(t,i,a),a};let Ee=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[],this._range={start:0,end:10},this._listItems=[],this._focusedIndex=-1}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-list","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>{const e=this.adapter.templateData;e.items&&this._listItems.length===0&&(this._listItems=e.items),this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){const e=this.adapter.templateData,t=e.touched&&e.errors&&e.errors.length>0,i=this._listItems.slice(this._range.start,this._range.end),n=this.adapter.getItemRenderer(e.itemRenderer,Ma);return d.html`
|
|
357
786
|
<gui-label
|
|
358
787
|
.targetElement=${this._guiListRef}
|
|
359
788
|
.uid=${this.widget.uid}
|
|
@@ -377,37 +806,230 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
377
806
|
?touched=${e.touched}
|
|
378
807
|
?disabled=${e.disabled}
|
|
379
808
|
?readonly=${e.readonly}
|
|
380
|
-
aria-labelledby=${e.label?`${this.widget.uid}_label`:
|
|
381
|
-
aria-describedby=${e.hint?`${this.widget.uid}_hint`:
|
|
809
|
+
aria-labelledby=${e.label?`${this.widget.uid}_label`:d.nothing}
|
|
810
|
+
aria-describedby=${e.hint?`${this.widget.uid}_hint`:d.nothing}
|
|
382
811
|
@gui-range-change=${this._onRangeChange}
|
|
383
812
|
@gui-update-items=${this._onUpdateItems}
|
|
384
813
|
@gui-focus-change=${this._onFocusChange}
|
|
385
814
|
@blur=${()=>this.adapter.onBlur()}
|
|
386
815
|
@change=${this._valueChanged}
|
|
387
816
|
>
|
|
388
|
-
${
|
|
817
|
+
${i.map((a,s)=>{const r=this._range.start+s,l=e.value===a.value,u=this._focusedIndex===r,p=e.labelField??"label",h=a.template!==null&&typeof a.template=="object"&&p&&!e.itemRenderer?a.template[p]:a.template;return d.html`
|
|
389
818
|
<div
|
|
390
819
|
role="option"
|
|
391
820
|
tabindex="-1"
|
|
392
821
|
class="gui-list__item-wrapper"
|
|
393
|
-
id="${this.widget.uid}-item-${
|
|
822
|
+
id="${this.widget.uid}-item-${r}"
|
|
394
823
|
style="height: ${e.itemHeight||40}px"
|
|
395
|
-
aria-selected=${
|
|
824
|
+
aria-selected=${l?"true":"false"}
|
|
396
825
|
aria-disabled=${e.disabled?"true":"false"}
|
|
397
|
-
@click=${()=>this._onClickItem(
|
|
826
|
+
@click=${()=>this._onClickItem(a,r)}
|
|
398
827
|
>
|
|
399
|
-
${
|
|
828
|
+
${n({template:h,value:a.value,index:r,selected:l,disabled:!!e.disabled,focused:u})}
|
|
400
829
|
</div>
|
|
401
830
|
`})}
|
|
402
831
|
</gui-list>
|
|
403
832
|
</div>
|
|
404
833
|
|
|
405
|
-
${t?
|
|
834
|
+
${t?d.html`<gui-errors
|
|
406
835
|
.uid=${this.widget.uid}
|
|
407
836
|
.errors=${e.errors}
|
|
408
837
|
.touched=${e.touched}
|
|
409
|
-
></gui-errors>`:
|
|
410
|
-
`}_onRangeChange(e){this._range={start:e.detail.startIndex,end:e.detail.endIndex}}_onUpdateItems(e){this._listItems=e.detail||[]}_onFocusChange(e){this._focusedIndex=e.detail.index}_onClickItem(e,t){this.adapter.templateData.disabled||(this.adapter.valueChanged(e.value),this._focusedIndex=t,this._guiListRef&&typeof this._guiListRef.focusItemAtIndex=="function"&&this._guiListRef.focusItemAtIndex(t))}_valueChanged(e){this.adapter.templateData.readonly||this.adapter.valueChanged(e.detail.value)}};
|
|
838
|
+
></gui-errors>`:d.nothing}
|
|
839
|
+
`}_onRangeChange(e){this._range={start:e.detail.startIndex,end:e.detail.endIndex}}_onUpdateItems(e){this._listItems=e.detail||[]}_onFocusChange(e){this._focusedIndex=e.detail.index}_onClickItem(e,t){this.adapter.templateData.disabled||(this.adapter.valueChanged(e.value),this._focusedIndex=t,this._guiListRef&&typeof this._guiListRef.focusItemAtIndex=="function"&&this._guiListRef.focusItemAtIndex(t))}_valueChanged(e){this.adapter.templateData.readonly||this.adapter.valueChanged(e.detail.value)}};Ne([D.consume({context:y.formContext}),o.property({attribute:!1})],Ee.prototype,"formContext",2),Ne([D.provide({context:y.inputContext})],Ee.prototype,"adapter",2),Ne([o.state()],Ee.prototype,"_range",2),Ne([o.state()],Ee.prototype,"_listItems",2),Ne([o.state()],Ee.prototype,"_focusedIndex",2),Ne([o.query("gui-list")],Ee.prototype,"_guiListRef",2),Ee=Ne([o.customElement("gui-list-input")],Ee);const kd=Object.freeze(Object.defineProperty({__proto__:null,get ListElement(){return Ee}},Symbol.toStringTag,{value:"Module"}));var _d=Object.defineProperty,Cd=Object.getOwnPropertyDescriptor,pi=(e,t,i,n)=>{for(var a=n>1?void 0:n?Cd(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&_d(t,i,a),a};let dt=class extends d.LitElement{constructor(){super(...arguments),this.md=void 0,this.dependencies=void 0}createRenderRoot(){return this}render(){return d.html`${Ba.unsafeHTML(this.dependencies?.markdown?.parse(this.md??""))}`}};pi([o.property({type:String})],dt.prototype,"md",2),pi([o.property({type:Object})],dt.prototype,"dependencies",2),dt=pi([o.customElement("gui-markdown-text")],dt),typeof customElements<"u"&&!customElements.get("gui-markdown-text")&&customElements.define("gui-markdown-text",dt);var Sd=Object.defineProperty,Od=Object.getOwnPropertyDescriptor,w=(e,t,i,n)=>{for(var a=n>1?void 0:n?Od(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Sd(t,i,a),a};let b=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.localeId="en",this.errors=[],this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.hint=void 0,this.tools=void 0,this.placeholder=void 0,this.autocomplete=void 0,this.minimumHeight=void 0,this.autoGrow=!1,this.defaultOpenPreview=void 0,this.maxLength=void 0,this.headingTitle=void 0,this.boldTitle=void 0,this.italicTitle=void 0,this.strikethroughTitle=void 0,this.quoteTitle=void 0,this.linkTitle=void 0,this.orderedListTitle=void 0,this.unorderedListTitle=void 0,this.splitViewTitle=void 0,this.dependencies=void 0,this.splitViewActive=!1,this.activeFormats={},this.splitViewInitialized=!1,this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(`textarea[id="${this.uid}"]`),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,readonly:this.readOnly,disabled:this.disabled,touched:this.touched}})})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}updated(){this.recalculateAutoGrow()}willUpdate(e){!this.splitViewInitialized&&e.has("defaultOpenPreview")&&(this.splitViewActive=!!this.defaultOpenPreview,this.splitViewInitialized=!0)}render(){super.render();const e={uid:this.uid,label:this.label,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,hint:this.hint,placeholder:this.placeholder,counterMode:this.counterMode??"remaining",minimumHeight:this.minimumHeight??120,autoGrow:this.autoGrow??!1,defaultOpenPreview:this.defaultOpenPreview??!1,maxLength:this.maxLength,dependencies:this.dependencies},t={"gui-markdown--icon":!1};let i=d.html``;if(e.counterMode&&e.maxLength){const a={"gui-markdown--counter":!0,"gui-markdown--counter__error":(e.value?.length??0)>e.maxLength},s=e.counterMode==="current"?d.html`<span>${e.value?.length??0}</span>`:d.html`<span>${e.maxLength-(e.value?.length??0)}</span>`;i=d.html`<div class=${$.classMap(a)}>
|
|
840
|
+
${s}
|
|
841
|
+
<span> / ${e.maxLength}</span>
|
|
842
|
+
</div>`}const n={"min-height":`${e.minimumHeight}px`};return d.html`
|
|
843
|
+
${le(this.uid,e)}
|
|
844
|
+
|
|
845
|
+
<div
|
|
846
|
+
class=${$.classMap({"gui-widget":!0,"gui-markdown--with-preview":this.splitViewActive})}
|
|
847
|
+
>
|
|
848
|
+
<nav class="gui-markdown__toolbar">
|
|
849
|
+
<ul>
|
|
850
|
+
${(this.tools??["H","B","I","S","Q","L","|","OL","UL"]).map(a=>this.renderToolbarItem(a))}
|
|
851
|
+
<li>
|
|
852
|
+
<button
|
|
853
|
+
type="button"
|
|
854
|
+
tabindex="0"
|
|
855
|
+
class=${$.classMap({"gui-markdown__toolbar-button":!0,"gui-markdown__toolbar-button--active":this.splitViewActive})}
|
|
856
|
+
@click=${this.splitView}
|
|
857
|
+
title=${this.splitViewTitle??"Split View"}
|
|
858
|
+
>
|
|
859
|
+
<svg
|
|
860
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
861
|
+
width="20"
|
|
862
|
+
height="20"
|
|
863
|
+
viewBox="0 0 256 256"
|
|
864
|
+
>
|
|
865
|
+
<path
|
|
866
|
+
d="M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40ZM56,56h64V200H56ZM200,200H136V56h64V200Z"
|
|
867
|
+
></path>
|
|
868
|
+
</svg>
|
|
869
|
+
</button>
|
|
870
|
+
</li>
|
|
871
|
+
</ul>
|
|
872
|
+
</nav>
|
|
873
|
+
<textarea
|
|
874
|
+
id=${Ut.ifDefined(this.uid)}
|
|
875
|
+
class=${$.classMap(t)}
|
|
876
|
+
style=${Vt.styleMap(n)}
|
|
877
|
+
?required=${e.required}
|
|
878
|
+
?disabled=${e.disabled}
|
|
879
|
+
?readonly=${e.readonly}
|
|
880
|
+
placeholder=${Ut.ifDefined(e.placeholder)}
|
|
881
|
+
autocomplete=${this.autocomplete||d.nothing}
|
|
882
|
+
.value=${this.value||""}
|
|
883
|
+
@input=${this.valueChanged}
|
|
884
|
+
@keyup=${this.detectFormats}
|
|
885
|
+
@mouseup=${this.detectFormats}
|
|
886
|
+
@blur=${this.onBlur}
|
|
887
|
+
></textarea>
|
|
888
|
+
|
|
889
|
+
${this.splitViewActive?d.html`
|
|
890
|
+
<section
|
|
891
|
+
data-cy=${Ut.ifDefined(this.uid?`${this.uid}_markdown`:d.nothing)}
|
|
892
|
+
class="gui-markdown__preview"
|
|
893
|
+
>
|
|
894
|
+
<gui-markdown-text
|
|
895
|
+
.md=${this.value||""}
|
|
896
|
+
.dependencies=${this.dependencies}
|
|
897
|
+
></gui-markdown-text>
|
|
898
|
+
</section>
|
|
899
|
+
`:d.nothing}
|
|
900
|
+
</div>
|
|
901
|
+
|
|
902
|
+
<div class="gui-markdown--validation">
|
|
903
|
+
<div>${V(this.uid,e)}</div>
|
|
904
|
+
${i}
|
|
905
|
+
</div>
|
|
906
|
+
`}recalculateAutoGrow(){if(!this.autoGrow)return;const e=this.querySelector(`textarea[id="${this.uid}"]`);if(!e)return;const t=window.getComputedStyle(e),i=parseFloat(t.paddingTop),n=parseFloat(t.paddingBottom),a=i+n;e.style.height="auto",e.style.height=`${Math.max(this.minimumHeight??120,e.scrollHeight-a)}px`}splitView(){this.splitViewActive=!this.splitViewActive}renderToolbarItem(e){switch(e){case"H":return d.html`<li>
|
|
907
|
+
<button
|
|
908
|
+
type="button"
|
|
909
|
+
tabindex="0"
|
|
910
|
+
class=${this.toolbarBtnClass("heading")}
|
|
911
|
+
@click=${this.applyFormat("# ","","heading")}
|
|
912
|
+
title=${this.headingTitle??"Heading"}
|
|
913
|
+
>
|
|
914
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
|
|
915
|
+
<path
|
|
916
|
+
d="M212,56V200a12,12,0,0,1-24,0V140H68v60a12,12,0,0,1-24,0V56a12,12,0,0,1,24,0v60H188V56a12,12,0,0,1,24,0Z"
|
|
917
|
+
></path>
|
|
918
|
+
</svg>
|
|
919
|
+
</button>
|
|
920
|
+
</li>`;case"B":return d.html`<li>
|
|
921
|
+
<button
|
|
922
|
+
type="button"
|
|
923
|
+
tabindex="0"
|
|
924
|
+
class=${this.toolbarBtnClass("bold")}
|
|
925
|
+
@click=${this.applyFormat("**","**","bold")}
|
|
926
|
+
title=${this.boldTitle??"Bold"}
|
|
927
|
+
>
|
|
928
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
|
|
929
|
+
<path
|
|
930
|
+
d="M185.08,114.46A48,48,0,0,0,148,36H80A12,12,0,0,0,68,48V200a12,12,0,0,0,12,12h80a52,52,0,0,0,25.08-97.54ZM92,60h56a24,24,0,0,1,0,48H92Zm68,128H92V132h68a28,28,0,0,1,0,56Z"
|
|
931
|
+
></path>
|
|
932
|
+
</svg>
|
|
933
|
+
</button>
|
|
934
|
+
</li>`;case"I":return d.html`<li>
|
|
935
|
+
<button
|
|
936
|
+
type="button"
|
|
937
|
+
tabindex="0"
|
|
938
|
+
class=${this.toolbarBtnClass("italic")}
|
|
939
|
+
@click=${this.applyFormat("_","_","italic")}
|
|
940
|
+
title=${this.italicTitle??"Italic"}
|
|
941
|
+
>
|
|
942
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
|
|
943
|
+
<path
|
|
944
|
+
d="M204,56a12,12,0,0,1-12,12H160.65l-40,120H144a12,12,0,0,1,0,24H64a12,12,0,0,1,0-24H95.35l40-120H112a12,12,0,0,1,0-24h80A12,12,0,0,1,204,56Z"
|
|
945
|
+
></path>
|
|
946
|
+
</svg>
|
|
947
|
+
</button>
|
|
948
|
+
</li>`;case"S":return d.html`<li>
|
|
949
|
+
<button
|
|
950
|
+
type="button"
|
|
951
|
+
tabindex="0"
|
|
952
|
+
class=${this.toolbarBtnClass("strikethrough")}
|
|
953
|
+
@click=${this.applyFormat("~~","~~","strikethrough")}
|
|
954
|
+
title=${this.strikethroughTitle??"Strikethrough"}
|
|
955
|
+
>
|
|
956
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
|
|
957
|
+
<path
|
|
958
|
+
d="M224,128a8,8,0,0,1-8,8H175.93c9.19,7.11,16.07,17.2,16.07,32,0,13.34-7,25.7-19.75,34.79C160.33,211.31,144.61,216,128,216s-32.33-4.69-44.25-13.21C71,193.7,64,181.34,64,168a8,8,0,0,1,16,0c0,17.35,22,32,48,32s48-14.65,48-32c0-14.85-10.54-23.58-38.77-32H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM76.33,104a8,8,0,0,0,7.61-10.49A17.3,17.3,0,0,1,83.11,88c0-18.24,19.3-32,44.89-32,18.84,0,34.16,7.42,41,19.85a8,8,0,0,0,14-7.7C173.33,50.52,152.77,40,128,40,93.29,40,67.11,60.63,67.11,88a33.73,33.73,0,0,0,1.62,10.49A8,8,0,0,0,76.33,104Z"
|
|
959
|
+
></path>
|
|
960
|
+
</svg>
|
|
961
|
+
</button>
|
|
962
|
+
</li>`;case"Q":return d.html`<li>
|
|
963
|
+
<button
|
|
964
|
+
type="button"
|
|
965
|
+
tabindex="0"
|
|
966
|
+
class=${this.toolbarBtnClass("quote")}
|
|
967
|
+
@click=${this.applyFormat("> ","","quote")}
|
|
968
|
+
title=${this.quoteTitle??"Quote"}
|
|
969
|
+
>
|
|
970
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
|
|
971
|
+
<path
|
|
972
|
+
d="M100,52H40A20,20,0,0,0,20,72v64a20,20,0,0,0,20,20H96v4a28,28,0,0,1-28,28,12,12,0,0,0,0,24,52.06,52.06,0,0,0,52-52V72A20,20,0,0,0,100,52Zm-4,80H44V76H96ZM216,52H156a20,20,0,0,0-20,20v64a20,20,0,0,0,20,20h56v4a28,28,0,0,1-28,28,12,12,0,0,0,0,24,52.06,52.06,0,0,0,52-52V72A20,20,0,0,0,216,52Zm-4,80H160V76h52Z"
|
|
973
|
+
></path>
|
|
974
|
+
</svg>
|
|
975
|
+
</button>
|
|
976
|
+
</li>`;case"L":return d.html`<li>
|
|
977
|
+
<button
|
|
978
|
+
type="button"
|
|
979
|
+
tabindex="0"
|
|
980
|
+
class=${this.toolbarBtnClass("link")}
|
|
981
|
+
@click=${this.applyFormat("[","](url)","link")}
|
|
982
|
+
title=${this.linkTitle??"Link"}
|
|
983
|
+
>
|
|
984
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
|
|
985
|
+
<path
|
|
986
|
+
d="M117.18,188.74a12,12,0,0,1,0,17l-5.12,5.12A58.26,58.26,0,0,1,70.6,228h0A58.62,58.62,0,0,1,29.14,127.92L63.89,93.17a58.64,58.64,0,0,1,98.56,28.11,12,12,0,1,1-23.37,5.44,34.65,34.65,0,0,0-58.22-16.58L46.11,144.89A34.62,34.62,0,0,0,70.57,204h0a34.41,34.41,0,0,0,24.49-10.14l5.11-5.12A12,12,0,0,1,117.18,188.74ZM226.83,45.17a58.65,58.65,0,0,0-82.93,0l-5.11,5.11a12,12,0,0,0,17,17l5.12-5.12a34.63,34.63,0,1,1,49,49L175.1,145.86A34.39,34.39,0,0,1,150.61,156h0a34.63,34.63,0,0,1-33.69-26.72,12,12,0,0,0-23.38,5.44A58.64,58.64,0,0,0,150.56,180h.05a58.28,58.28,0,0,0,41.47-17.17l34.75-34.75a58.62,58.62,0,0,0,0-82.91Z"
|
|
987
|
+
></path>
|
|
988
|
+
</svg>
|
|
989
|
+
</button>
|
|
990
|
+
</li>`;case"OL":return d.html`<li>
|
|
991
|
+
<button
|
|
992
|
+
type="button"
|
|
993
|
+
tabindex="0"
|
|
994
|
+
class=${this.toolbarBtnClass("orderedList")}
|
|
995
|
+
@click=${this.applyFormat("1. ","","orderedList")}
|
|
996
|
+
title=${this.orderedListTitle??"Ordered List"}
|
|
997
|
+
>
|
|
998
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
|
|
999
|
+
<path
|
|
1000
|
+
d="M228,128a12,12,0,0,1-12,12H116a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128ZM116,76H216a12,12,0,0,0,0-24H116a12,12,0,0,0,0,24ZM216,180H116a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,59.31V104a12,12,0,0,0,24,0V40A12,12,0,0,0,50.64,29.27l-16,8a12,12,0,0,0,9.36,22Zm39.73,96.86a27.7,27.7,0,0,0-11.2-18.63A28.89,28.89,0,0,0,32.9,143a27.71,27.71,0,0,0-4.17,7.54,12,12,0,0,0,22.55,8.21,4,4,0,0,1,.58-1,4.78,4.78,0,0,1,6.5-.82,3.82,3.82,0,0,1,1.61,2.6,3.63,3.63,0,0,1-.77,2.77l-.13.17L30.39,200.82A12,12,0,0,0,40,220H72a12,12,0,0,0,0-24H64l14.28-19.11A27.48,27.48,0,0,0,83.73,156.17Z"
|
|
1001
|
+
></path>
|
|
1002
|
+
</svg>
|
|
1003
|
+
</button>
|
|
1004
|
+
</li>`;case"UL":return d.html`<li>
|
|
1005
|
+
<button
|
|
1006
|
+
type="button"
|
|
1007
|
+
tabindex="0"
|
|
1008
|
+
class=${this.toolbarBtnClass("unorderedList")}
|
|
1009
|
+
@click=${this.applyFormat("- ","","unorderedList")}
|
|
1010
|
+
title=${this.unorderedListTitle??"Unordered List"}
|
|
1011
|
+
>
|
|
1012
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
|
|
1013
|
+
<path
|
|
1014
|
+
d="M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z"
|
|
1015
|
+
></path>
|
|
1016
|
+
</svg>
|
|
1017
|
+
</button>
|
|
1018
|
+
</li>`;case"|":return d.html`<li>
|
|
1019
|
+
<span class="gui-markdown__toolbar-separator">
|
|
1020
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
|
|
1021
|
+
<path d="M140,24V232a12,12,0,0,1-24,0V24a12,12,0,0,1,24,0Z"></path>
|
|
1022
|
+
</svg>
|
|
1023
|
+
</span>
|
|
1024
|
+
</li>`;default:return d.nothing}}toolbarBtnClass(e){return $.classMap({"gui-markdown__toolbar-button":!0,"gui-markdown__toolbar-button--active":!!e&&!!this.activeFormats[e]})}detectFormats(){const e=this.querySelector(`textarea[id="${this.uid}"]`);if(!e)return;const{selectionStart:t,value:i}=e,n=i.lastIndexOf(`
|
|
1025
|
+
`,t-1)+1,a=i.indexOf(`
|
|
1026
|
+
`,t),s=i.substring(n,a===-1?i.length:a);this.activeFormats={heading:/^#{1,6}\s/.test(s),bold:this.isInsideInlineFormat(i,t,"**"),italic:this.isInsideInlineFormat(i,t,"_"),strikethrough:this.isInsideInlineFormat(i,t,"~~"),quote:s.startsWith("> "),link:this.isInsideLink(i,t),orderedList:/^\d+\.\s/.test(s),unorderedList:s.startsWith("- ")}}isInsideInlineFormat(e,t,i){const n=e.lastIndexOf(`
|
|
1027
|
+
`,t-1)+1,a=e.indexOf(`
|
|
1028
|
+
`,t),s=e.substring(n,a===-1?e.length:a),r=t-n;let l=0;for(;l<s.length;){const u=s.indexOf(i,l);if(u===-1)break;const p=s.indexOf(i,u+i.length);if(p===-1)break;if(r>=u&&r<=p+i.length)return!0;l=p+i.length}return!1}isInsideLink(e,t){const i=e.lastIndexOf(`
|
|
1029
|
+
`,t-1)+1,n=e.indexOf(`
|
|
1030
|
+
`,t),a=e.substring(i,n===-1?e.length:n),s=t-i,r=/\[[^\]]*\]\([^)]*\)/g;let l;for(;(l=r.exec(a))!==null;)if(s>=l.index&&s<=l.index+l[0].length)return!0;return!1}applyFormat(e,t="",i=""){return()=>{const n=this.querySelector(`textarea[id="${this.uid}"]`);if(n){if(i&&this.activeFormats[i])this.removeFormat(n,e,t,i);else{const{selectionStart:a,selectionEnd:s,value:r}=n,l=r.substring(a,s),u=r.substring(0,a),p=r.substring(s);n.value=`${u}${e}${l}${t}${p}`,n.selectionStart=a+e.length,n.selectionEnd=a+e.length+l.length}n.focus(),n.dispatchEvent(new Event("input",{bubbles:!0})),this.detectFormats()}}}removeFormat(e,t,i,n){const{selectionStart:a,value:s}=e,r=s.lastIndexOf(`
|
|
1031
|
+
`,a-1)+1,l=s.indexOf(`
|
|
1032
|
+
`,a),u=s.substring(r,l===-1?s.length:l);if(i)if(n==="link"){const p=a-r,c=/\[([^\]]*)\]\([^)]*\)/g;let h;for(;(h=c.exec(u))!==null;)if(p>=h.index&&p<=h.index+h[0].length){const f=h[1],g=r+h.index,_=g+h[0].length;e.value=`${s.substring(0,g)}${f}${s.substring(_)}`,e.selectionStart=g,e.selectionEnd=g+f.length;break}}else{const p=a-r;let c=0;for(;c<u.length;){const h=u.indexOf(t,c);if(h===-1)break;const f=u.indexOf(i,h+t.length);if(f===-1)break;if(p>=h&&p<=f+i.length){const g=u.substring(h+t.length,f),_=r+h,T=r+f+i.length;e.value=`${s.substring(0,_)}${g}${s.substring(T)}`,e.selectionStart=_,e.selectionEnd=_+g.length;break}c=f+i.length}}else{let p=t;if(n==="heading"){const g=u.match(/^#{1,6}\s/);g&&(p=g[0])}else if(n==="orderedList"){const g=u.match(/^\d+\.\s/);g&&(p=g[0])}const c=s.substring(0,r),h=u.substring(p.length),f=s.substring(l===-1?s.length:l);e.value=`${c}${h}${f}`,e.selectionStart=Math.max(r,a-p.length),e.selectionEnd=e.selectionStart}}valueChanged(e){if(e.stopPropagation(),!this.readOnly){const t=e.target;this.dispatchEvent(new CustomEvent("input",{detail:{value:t.value},bubbles:!0,composed:!0}))}}onBlur(){this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0}))}};w([o.property({type:String})],b.prototype,"uid",2),w([o.property({type:String})],b.prototype,"label",2),w([o.property({type:String,attribute:"locale-id"})],b.prototype,"localeId",2),w([o.property({type:Array})],b.prototype,"errors",2),w([o.property({type:Boolean})],b.prototype,"touched",2),w([o.property({type:Boolean})],b.prototype,"required",2),w([o.property({type:Boolean})],b.prototype,"disabled",2),w([o.property({type:Boolean,attribute:"readonly"})],b.prototype,"readOnly",2),w([o.property({type:String})],b.prototype,"value",2),w([o.property({type:String})],b.prototype,"hint",2),w([o.property({type:Array})],b.prototype,"tools",2),w([o.property({type:String})],b.prototype,"placeholder",2),w([o.property({type:String})],b.prototype,"autocomplete",2),w([o.property({type:String,attribute:"countermode"})],b.prototype,"counterMode",2),w([o.property({type:Number,attribute:"minimumheight"})],b.prototype,"minimumHeight",2),w([o.property({type:Boolean,attribute:"autogrow"})],b.prototype,"autoGrow",2),w([o.property({type:Boolean,attribute:"defaultopenpreview"})],b.prototype,"defaultOpenPreview",2),w([o.property({type:Number,attribute:"maxlength"})],b.prototype,"maxLength",2),w([o.property({type:String})],b.prototype,"headingTitle",2),w([o.property({type:String})],b.prototype,"boldTitle",2),w([o.property({type:String})],b.prototype,"italicTitle",2),w([o.property({type:String})],b.prototype,"strikethroughTitle",2),w([o.property({type:String})],b.prototype,"quoteTitle",2),w([o.property({type:String})],b.prototype,"linkTitle",2),w([o.property({type:String})],b.prototype,"orderedListTitle",2),w([o.property({type:String})],b.prototype,"unorderedListTitle",2),w([o.property({type:String})],b.prototype,"splitViewTitle",2),w([o.property({type:Object})],b.prototype,"dependencies",2),w([o.state()],b.prototype,"splitViewActive",2),w([o.state()],b.prototype,"activeFormats",2),b=w([o.customElement("gui-markdown")],b),typeof customElements<"u"&&!customElements.get("gui-markdown")&&customElements.define("gui-markdown",b);var xd=Object.defineProperty,Ed=Object.getOwnPropertyDescriptor,ci=(e,t,i,n)=>{for(var a=n>1?void 0:n?Ed(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&xd(t,i,a),a};let ut=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-markdown","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
411
1033
|
<gui-markdown
|
|
412
1034
|
.uid=${this.widget.uid}
|
|
413
1035
|
.label=${this.adapter.templateData.label}
|
|
@@ -430,7 +1052,40 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
430
1052
|
@input=${this.valueChanged}
|
|
431
1053
|
@blur=${()=>this.adapter.onBlur()}
|
|
432
1054
|
></gui-markdown>
|
|
433
|
-
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1055
|
+
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};ci([D.consume({context:y.formContext}),o.property({attribute:!1})],ut.prototype,"formContext",2),ci([D.provide({context:y.inputContext})],ut.prototype,"adapter",2),ut=ci([o.customElement("gui-markdown-input")],ut);const Pd=Object.freeze(Object.defineProperty({__proto__:null,get MarkdownElement(){return ut}},Symbol.toStringTag,{value:"Module"}));var Id=Object.defineProperty,Ad=Object.getOwnPropertyDescriptor,R=(e,t,i,n)=>{for(var a=n>1?void 0:n?Ad(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Id(t,i,a),a};let L=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.localeId="en",this.errors=[],this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.hint=void 0,this.icon=void 0,this.placeholder=void 0,this.autocomplete=void 0,this.showPasswordIcon=void 0,this.hidePasswordIcon=void 0,this.showPasswordLabel=void 0,this.hidePasswordLabel=void 0,this.showPassword=!1,this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(`input[id="${this.uid}"]`),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,readonly:this.readOnly,disabled:this.disabled,touched:this.touched}})})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}render(){super.render();const e={uid:this.uid,label:this.label,hint:this.hint,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,icon:this.icon,placeholder:this.placeholder,autocomplete:this.autocomplete,showPasswordIcon:this.showPasswordIcon,hidePasswordIcon:this.hidePasswordIcon,showPasswordLabel:this.showPasswordLabel,hidePasswordLabel:this.hidePasswordLabel},t=Fe("password",e),i={"gui-password--icon":!!this.icon};return d.html`
|
|
1056
|
+
${le(this.uid,e)}
|
|
1057
|
+
|
|
1058
|
+
<div class="gui-widget">
|
|
1059
|
+
<input
|
|
1060
|
+
type=${this.showPassword?"text":"password"}
|
|
1061
|
+
id=${this.uid}
|
|
1062
|
+
data-cy=${`${this.uid}_password`}
|
|
1063
|
+
class=${$.classMap(i)}
|
|
1064
|
+
value=${this.value}
|
|
1065
|
+
?required=${this.disabled}
|
|
1066
|
+
?disabled=${this.disabled}
|
|
1067
|
+
?readonly=${this.readOnly}
|
|
1068
|
+
placeholder=${this.placeholder||d.nothing}
|
|
1069
|
+
autocomplete=${this.autocomplete||d.nothing}
|
|
1070
|
+
@input=${this.valueChanged}
|
|
1071
|
+
@blur=${this.onBlur}
|
|
1072
|
+
/>
|
|
1073
|
+
${t.html}
|
|
1074
|
+
<button
|
|
1075
|
+
class=${`gui-password__toggle gui-widget-icon ${this.showPassword&&e.showPasswordIcon?e.showPasswordIcon:""} ${!this.showPassword&&e.hidePasswordIcon?e.hidePasswordIcon:""}`}
|
|
1076
|
+
data-icon=${this.showPassword?e.showPasswordIcon:e.hidePasswordIcon}
|
|
1077
|
+
type="button"
|
|
1078
|
+
tabindex="-1"
|
|
1079
|
+
@click=${()=>this.showPassword=!this.showPassword}
|
|
1080
|
+
>
|
|
1081
|
+
${e.showPasswordIcon||e.hidePasswordIcon?d.nothing:d.html`<span
|
|
1082
|
+
>${this.showPassword?e.hidePasswordLabel??"Hide":e.showPasswordLabel??"Show"}</span
|
|
1083
|
+
>`}
|
|
1084
|
+
</button>
|
|
1085
|
+
</div>
|
|
1086
|
+
|
|
1087
|
+
${V(this.uid,e)}
|
|
1088
|
+
`}valueChanged(e){if(e.stopPropagation(),!this.readOnly){const t=e.target;this.dispatchEvent(new CustomEvent("input",{detail:{value:t.value},bubbles:!0,composed:!0}))}}onBlur(){this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0}))}};R([o.property({type:String})],L.prototype,"uid",2),R([o.property({type:String})],L.prototype,"label",2),R([o.property({type:String,attribute:"locale-id"})],L.prototype,"localeId",2),R([o.property({type:Array})],L.prototype,"errors",2),R([o.property({type:Boolean})],L.prototype,"touched",2),R([o.property({type:Boolean})],L.prototype,"required",2),R([o.property({type:Boolean})],L.prototype,"disabled",2),R([o.property({type:Boolean,attribute:"readonly"})],L.prototype,"readOnly",2),R([o.property({type:String})],L.prototype,"value",2),R([o.property({type:String})],L.prototype,"hint",2),R([o.property({type:String})],L.prototype,"icon",2),R([o.property({type:String})],L.prototype,"placeholder",2),R([o.property({type:String})],L.prototype,"autocomplete",2),R([o.property({type:String})],L.prototype,"showPasswordIcon",2),R([o.property({type:String})],L.prototype,"hidePasswordIcon",2),R([o.property({type:String})],L.prototype,"showPasswordLabel",2),R([o.property({type:String})],L.prototype,"hidePasswordLabel",2),R([o.state()],L.prototype,"showPassword",2),L=R([o.customElement("gui-password")],L),typeof customElements<"u"&&!customElements.get("gui-password")&&customElements.define("gui-password",L);var Td=Object.defineProperty,Ld=Object.getOwnPropertyDescriptor,hi=(e,t,i,n)=>{for(var a=n>1?void 0:n?Ld(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Td(t,i,a),a};let pt=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-password","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
434
1089
|
<gui-password
|
|
435
1090
|
.uid=${this.widget.uid}
|
|
436
1091
|
.label=${this.adapter.templateData.label}
|
|
@@ -451,7 +1106,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
451
1106
|
@input=${this.valueChanged}
|
|
452
1107
|
@blur=${()=>this.adapter.onBlur()}
|
|
453
1108
|
></gui-password>
|
|
454
|
-
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1109
|
+
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};hi([D.consume({context:y.formContext}),o.property({attribute:!1})],pt.prototype,"formContext",2),hi([D.provide({context:y.inputContext})],pt.prototype,"adapter",2),pt=hi([o.customElement("gui-password-input")],pt);const Md=Object.freeze(Object.defineProperty({__proto__:null,get PasswordElement(){return pt}},Symbol.toStringTag,{value:"Module"}));var zd=Object.defineProperty,Fd=Object.getOwnPropertyDescriptor,ue=(e,t,i,n)=>{for(var a=n>1?void 0:n?Fd(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&zd(t,i,a),a};let ee=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.localeId="en",this.errors=[],this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.hint=void 0,this.icon=void 0,this.placeholder=void 0,this.autocomplete=void 0,this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(`input[id="${this.uid}"]`),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,readonly:this.readOnly,disabled:this.disabled,touched:this.touched}})})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}render(){super.render();const e={uid:this.uid,label:this.label,hint:this.hint,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,icon:this.icon,placeholder:this.placeholder,autocomplete:this.autocomplete},t=Fe("textinput",e),i={"gui-textinput--icon":!!this.icon};return d.html`
|
|
1110
|
+
${le(this.uid,e)}
|
|
1111
|
+
|
|
1112
|
+
<div class="gui-widget">
|
|
1113
|
+
<input
|
|
1114
|
+
type="text"
|
|
1115
|
+
id=${this.uid}
|
|
1116
|
+
data-cy=${`${this.uid}_textinput`}
|
|
1117
|
+
class=${$.classMap(i)}
|
|
1118
|
+
value=${this.value}
|
|
1119
|
+
?required=${this.disabled}
|
|
1120
|
+
?disabled=${this.disabled}
|
|
1121
|
+
?readonly=${this.readOnly}
|
|
1122
|
+
placeholder=${this.placeholder||d.nothing}
|
|
1123
|
+
autocomplete=${this.autocomplete||d.nothing}
|
|
1124
|
+
@input=${this.valueChanged}
|
|
1125
|
+
@blur=${this.onBlur}
|
|
1126
|
+
/>
|
|
1127
|
+
${t.html}
|
|
1128
|
+
</div>
|
|
1129
|
+
|
|
1130
|
+
${V(this.uid,e)}
|
|
1131
|
+
`}valueChanged(e){if(e.stopPropagation(),!this.readOnly){const t=e.target;this.dispatchEvent(new CustomEvent("input",{detail:{value:t.value},bubbles:!0,composed:!0}))}}onBlur(){this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0}))}};ue([o.property({type:String})],ee.prototype,"uid",2),ue([o.property({type:String})],ee.prototype,"label",2),ue([o.property({type:String,attribute:"locale-id"})],ee.prototype,"localeId",2),ue([o.property({type:Array})],ee.prototype,"errors",2),ue([o.property({type:Boolean})],ee.prototype,"touched",2),ue([o.property({type:Boolean})],ee.prototype,"required",2),ue([o.property({type:Boolean})],ee.prototype,"disabled",2),ue([o.property({type:Boolean,attribute:"readonly"})],ee.prototype,"readOnly",2),ue([o.property({type:String})],ee.prototype,"value",2),ue([o.property({type:String})],ee.prototype,"hint",2),ue([o.property({type:String})],ee.prototype,"icon",2),ue([o.property({type:String})],ee.prototype,"placeholder",2),ue([o.property({type:String})],ee.prototype,"autocomplete",2),ee=ue([o.customElement("gui-textinput")],ee),typeof customElements<"u"&&!customElements.get("gui-textinput")&&customElements.define("gui-textinput",ee);var Rd=Object.defineProperty,Nd=Object.getOwnPropertyDescriptor,mi=(e,t,i,n)=>{for(var a=n>1?void 0:n?Nd(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Rd(t,i,a),a};let ct=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-textinput","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
455
1132
|
<gui-textinput
|
|
456
1133
|
.uid=${this.widget.uid}
|
|
457
1134
|
.label=${this.adapter.templateData.label}
|
|
@@ -468,7 +1145,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
468
1145
|
@input=${this.valueChanged}
|
|
469
1146
|
@blur=${()=>this.adapter.onBlur()}
|
|
470
1147
|
></gui-textinput>
|
|
471
|
-
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1148
|
+
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};mi([D.consume({context:y.formContext}),o.property({attribute:!1})],ct.prototype,"formContext",2),mi([D.provide({context:y.inputContext})],ct.prototype,"adapter",2),ct=mi([o.customElement("gui-textinput-input")],ct);const qd=Object.freeze(Object.defineProperty({__proto__:null,get TextinputElement(){return ct}},Symbol.toStringTag,{value:"Module"}));var Bd=Object.defineProperty,Zd=Object.getOwnPropertyDescriptor,Y=(e,t,i,n)=>{for(var a=n>1?void 0:n?Zd(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Bd(t,i,a),a};let N=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.localeId="en",this.errors=[],this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.hint=void 0,this.placeholder=void 0,this.autocomplete=void 0,this.minimumHeight=void 0,this.autoGrow=!1,this.maxLength=void 0,this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(`textarea[id="${this.uid}"]`),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,readonly:this.readOnly,disabled:this.disabled,touched:this.touched}})})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}render(){super.render();const e={uid:this.uid,label:this.label,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,hint:this.hint,placeholder:this.placeholder,autocomplete:this.autocomplete,counterMode:this.counterMode??"remaining",minimumHeight:this.minimumHeight??120,autoGrow:this.autoGrow??!1,maxLength:this.maxLength};let t=d.html``;if(e.counterMode&&e.maxLength){const a={"gui-textarea--counter":!0,"gui-textarea--counter__error":(e.value?.length??0)>e.maxLength},s=e.counterMode==="current"?d.html`<span>${e.value?.length??0}</span>`:d.html`<span>${e.maxLength-(e.value?.length??0)}</span>`;t=d.html`<div class=${$.classMap(a)}>
|
|
1149
|
+
${s}
|
|
1150
|
+
<span> / ${e.maxLength}</span>
|
|
1151
|
+
</div>`}const i={height:`${e.minimumHeight}px`,"min-height":`${e.minimumHeight}px`},n=this.querySelector(`textarea[id="${this.uid}"]`);if(this.autoGrow&&n){const a=window.getComputedStyle(n),s=parseFloat(a.paddingTop),r=parseFloat(a.paddingBottom),l=s+r;n.style.height="auto",i.height=`${Math.max(this.minimumHeight??120,n.scrollHeight-l)}px`}return d.html`
|
|
1152
|
+
${le(this.uid,e)}
|
|
1153
|
+
|
|
1154
|
+
<div class="gui-widget">
|
|
1155
|
+
<textarea
|
|
1156
|
+
id=${this.uid}
|
|
1157
|
+
data-cy=${`${this.uid}_textarea`}
|
|
1158
|
+
style=${Vt.styleMap(i)}
|
|
1159
|
+
?required=${e.required}
|
|
1160
|
+
?disabled=${e.disabled}
|
|
1161
|
+
?readonly=${e.readonly}
|
|
1162
|
+
placeholder=${e.placeholder||d.nothing}
|
|
1163
|
+
autocomplete=${this.autocomplete||d.nothing}
|
|
1164
|
+
@input=${this.valueChanged}
|
|
1165
|
+
@blur=${this.onBlur}
|
|
1166
|
+
></textarea>
|
|
1167
|
+
</div>
|
|
1168
|
+
|
|
1169
|
+
<div class="gui-textarea--validation">
|
|
1170
|
+
<div>${V(this.uid,e)}</div>
|
|
1171
|
+
${t}
|
|
1172
|
+
</div>
|
|
1173
|
+
`}valueChanged(e){if(e.stopPropagation(),!this.readOnly){const t=e.target;this.dispatchEvent(new CustomEvent("input",{detail:{value:t.value},bubbles:!0,composed:!0}))}}onBlur(){this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0}))}};Y([o.property({type:String})],N.prototype,"uid",2),Y([o.property({type:String})],N.prototype,"label",2),Y([o.property({type:String,attribute:"locale-id"})],N.prototype,"localeId",2),Y([o.property({type:Array})],N.prototype,"errors",2),Y([o.property({type:Boolean})],N.prototype,"touched",2),Y([o.property({type:Boolean})],N.prototype,"required",2),Y([o.property({type:Boolean})],N.prototype,"disabled",2),Y([o.property({type:Boolean,attribute:"readonly"})],N.prototype,"readOnly",2),Y([o.property({type:String})],N.prototype,"value",2),Y([o.property({type:String})],N.prototype,"hint",2),Y([o.property({type:String})],N.prototype,"placeholder",2),Y([o.property({type:String})],N.prototype,"autocomplete",2),Y([o.property({type:String,attribute:"countermode"})],N.prototype,"counterMode",2),Y([o.property({type:Number,attribute:"minimumheight"})],N.prototype,"minimumHeight",2),Y([o.property({type:Boolean,attribute:"autogrow"})],N.prototype,"autoGrow",2),Y([o.property({type:Number,attribute:"maxlength"})],N.prototype,"maxLength",2),N=Y([o.customElement("gui-textarea")],N),typeof customElements<"u"&&!customElements.get("gui-textarea")&&customElements.define("gui-textarea",N);var Vd=Object.defineProperty,Ud=Object.getOwnPropertyDescriptor,yi=(e,t,i,n)=>{for(var a=n>1?void 0:n?Ud(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Vd(t,i,a),a};let ht=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-textarea","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
472
1174
|
<gui-textarea
|
|
473
1175
|
.uid=${this.widget.uid}
|
|
474
1176
|
.label=${this.adapter.templateData.label}
|
|
@@ -488,7 +1190,38 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
488
1190
|
@input=${this.valueChanged}
|
|
489
1191
|
@blur=${()=>this.adapter.onBlur()}
|
|
490
1192
|
></gui-textarea>
|
|
491
|
-
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1193
|
+
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};yi([D.consume({context:y.formContext}),o.property({attribute:!1})],ht.prototype,"formContext",2),yi([D.provide({context:y.inputContext})],ht.prototype,"adapter",2),ht=yi([o.customElement("gui-textarea-input")],ht);const Wd=Object.freeze(Object.defineProperty({__proto__:null,get TextareaElement(){return ht}},Symbol.toStringTag,{value:"Module"}));var Gd=Object.defineProperty,Hd=Object.getOwnPropertyDescriptor,be=(e,t,i,n)=>{for(var a=n>1?void 0:n?Hd(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Gd(t,i,a),a};let pe=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.localeId="en",this.errors=[],this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.hint=void 0,this.togglePosition="left",this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll('span[role="presentation"]'),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,touched:this.touched,readonly:!1,disabled:!1}})})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}render(){super.render();const e={uid:this.uid,label:this.label,hint:this.hint,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,togglePosition:this.togglePosition};return e.togglePosition==="right"?this.classList.add("gui-toggle--right"):this.classList.contains("gui-toggle--right")&&this.classList.remove("gui-toggle--right"),d.html`
|
|
1194
|
+
<label
|
|
1195
|
+
class="gui-label"
|
|
1196
|
+
for=${this.uid}
|
|
1197
|
+
data-cy=${`${this.uid}_label`}
|
|
1198
|
+
id=${`${this.uid}_label`}
|
|
1199
|
+
>
|
|
1200
|
+
<div class="gui-widget gui-widget--horizontal gui-toggle--switch">
|
|
1201
|
+
<input
|
|
1202
|
+
type="checkbox"
|
|
1203
|
+
tabindex="0"
|
|
1204
|
+
id=${this.uid}
|
|
1205
|
+
data-cy=${`${this.uid}_toggle`}
|
|
1206
|
+
?checked=${e.value}
|
|
1207
|
+
?required=${e.required}
|
|
1208
|
+
?disabled=${e.disabled||e.readonly}
|
|
1209
|
+
@change=${this.valueChanged}
|
|
1210
|
+
@blur=${this.onBlur}
|
|
1211
|
+
/>
|
|
1212
|
+
|
|
1213
|
+
<span class="gui-toggle--slider" role="presentation"></span>
|
|
1214
|
+
</div>
|
|
1215
|
+
|
|
1216
|
+
<span class="gui-label__container">
|
|
1217
|
+
${e.label+(e.required?" *":"")}
|
|
1218
|
+
</span>
|
|
1219
|
+
</label>
|
|
1220
|
+
|
|
1221
|
+
<div class="gui-widget-hint" id=${`${e.uid}_hint`}>
|
|
1222
|
+
${e.hint??d.nothing} ${V(this.uid,e)}
|
|
1223
|
+
</div>
|
|
1224
|
+
`}valueChanged(e){if(e?.stopPropagation(),!this.readOnly){const t=e?.target;this.dispatchEvent(new CustomEvent("change",{detail:{value:t.checked},bubbles:!0,composed:!0}))}}onBlur(){this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0}))}};be([o.property({type:String})],pe.prototype,"uid",2),be([o.property({type:String})],pe.prototype,"label",2),be([o.property({type:String,attribute:"locale-id"})],pe.prototype,"localeId",2),be([o.property({type:Array})],pe.prototype,"errors",2),be([o.property({type:Boolean})],pe.prototype,"touched",2),be([o.property({type:Boolean})],pe.prototype,"required",2),be([o.property({type:Boolean})],pe.prototype,"disabled",2),be([o.property({type:Boolean,attribute:"readonly"})],pe.prototype,"readOnly",2),be([o.property({type:String})],pe.prototype,"value",2),be([o.property({type:String})],pe.prototype,"hint",2),be([o.property({type:String})],pe.prototype,"togglePosition",2),pe=be([o.customElement("gui-toggle")],pe),typeof customElements<"u"&&!customElements.get("gui-toggle")&&customElements.define("gui-toggle",pe);var Yd=Object.defineProperty,Kd=Object.getOwnPropertyDescriptor,fi=(e,t,i,n)=>{for(var a=n>1?void 0:n?Kd(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Yd(t,i,a),a};let mt=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-toggle","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
492
1225
|
<gui-toggle
|
|
493
1226
|
.uid=${this.widget.uid}
|
|
494
1227
|
.label=${this.adapter.templateData.label}
|
|
@@ -503,7 +1236,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
503
1236
|
@change=${this.valueChanged}
|
|
504
1237
|
@blur=${()=>this.adapter.onBlur()}
|
|
505
1238
|
></gui-toggle>
|
|
506
|
-
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1239
|
+
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};fi([D.consume({context:y.formContext}),o.property({attribute:!1})],mt.prototype,"formContext",2),fi([D.provide({context:y.inputContext})],mt.prototype,"adapter",2),mt=fi([o.customElement("gui-toggle-input")],mt);const Jd=Object.freeze(Object.defineProperty({__proto__:null,get ToggleElement(){return mt}},Symbol.toStringTag,{value:"Module"}));var Xd=Object.defineProperty,Qd=Object.getOwnPropertyDescriptor,ve=(e,t,i,n)=>{for(var a=n>1?void 0:n?Qd(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Xd(t,i,a),a};let ce=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.localeId="en",this.errors=[],this.touched=void 0,this.required=void 0,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.hint=void 0,this.checkboxPosition="left",this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(`input[id="${this.uid}"]`),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,touched:this.touched,readonly:!1,disabled:!1}})})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}render(){super.render();const e={uid:this.uid,label:this.label,hint:this.hint,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,checkboxPosition:this.checkboxPosition};return e.checkboxPosition==="right"?this.classList.add("gui-checkbox--right"):this.classList.contains("gui-checkbox--right")&&this.classList.remove("gui-checkbox--right"),d.html`
|
|
1240
|
+
<label
|
|
1241
|
+
class="gui-label"
|
|
1242
|
+
for=${this.uid}
|
|
1243
|
+
data-cy=${`${this.uid}_label`}
|
|
1244
|
+
id=${`${this.uid}_label`}
|
|
1245
|
+
>
|
|
1246
|
+
<div class="gui-widget gui-widget--horizontal">
|
|
1247
|
+
<input
|
|
1248
|
+
type="checkbox"
|
|
1249
|
+
tabindex="0"
|
|
1250
|
+
id=${this.uid}
|
|
1251
|
+
data-cy=${`${this.uid}_checkbox`}
|
|
1252
|
+
?checked=${this.value}
|
|
1253
|
+
?required=${this.required}
|
|
1254
|
+
?disabled=${this.disabled||this.readOnly}
|
|
1255
|
+
@change=${this.valueChanged}
|
|
1256
|
+
@blur=${this.onBlur}
|
|
1257
|
+
/>
|
|
1258
|
+
</div>
|
|
1259
|
+
|
|
1260
|
+
<span class="gui-label__container">
|
|
1261
|
+
${e.label+(e.required?" *":"")}
|
|
1262
|
+
</span>
|
|
1263
|
+
</label>
|
|
1264
|
+
|
|
1265
|
+
<div class="gui-widget-hint" id=${`${e.uid}_hint`}>
|
|
1266
|
+
${e.hint??d.nothing} ${V(this.uid,e)}
|
|
1267
|
+
</div>
|
|
1268
|
+
`}valueChanged(e){if(e.stopPropagation(),!this.readOnly){const t=e.target;this.dispatchEvent(new CustomEvent("change",{detail:{value:t.checked},bubbles:!0,composed:!0}))}}onBlur(){this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0}))}};ve([o.property({type:String})],ce.prototype,"uid",2),ve([o.property({type:String})],ce.prototype,"label",2),ve([o.property({type:String,attribute:"locale-id"})],ce.prototype,"localeId",2),ve([o.property({type:Array})],ce.prototype,"errors",2),ve([o.property({type:Boolean})],ce.prototype,"touched",2),ve([o.property({type:Boolean})],ce.prototype,"required",2),ve([o.property({type:Boolean})],ce.prototype,"disabled",2),ve([o.property({type:Boolean,attribute:"readonly"})],ce.prototype,"readOnly",2),ve([o.property({type:String})],ce.prototype,"value",2),ve([o.property({type:String})],ce.prototype,"hint",2),ve([o.property({type:String})],ce.prototype,"checkboxPosition",2),ce=ve([o.customElement("gui-checkbox")],ce),typeof customElements<"u"&&!customElements.get("gui-checkbox")&&customElements.define("gui-checkbox",ce);var jd=Object.defineProperty,eu=Object.getOwnPropertyDescriptor,gi=(e,t,i,n)=>{for(var a=n>1?void 0:n?eu(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&jd(t,i,a),a};let yt=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-checkbox","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
507
1269
|
<gui-checkbox
|
|
508
1270
|
.uid=${this.widget.uid}
|
|
509
1271
|
.label=${this.adapter.templateData.label}
|
|
@@ -518,7 +1280,51 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
518
1280
|
@change=${this.valueChanged}
|
|
519
1281
|
@blur=${()=>this.adapter.onBlur()}
|
|
520
1282
|
></gui-checkbox>
|
|
521
|
-
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1283
|
+
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};gi([D.consume({context:y.formContext}),o.property({attribute:!1})],yt.prototype,"formContext",2),gi([D.provide({context:y.inputContext})],yt.prototype,"adapter",2),yt=gi([o.customElement("gui-checkbox-input")],yt);const tu=Object.freeze(Object.defineProperty({__proto__:null,get CheckboxElement(){return yt}},Symbol.toStringTag,{value:"Module"}));var iu=Object.defineProperty,au=Object.getOwnPropertyDescriptor,K=(e,t,i,n)=>{for(var a=n>1?void 0:n?au(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&iu(t,i,a),a};let q=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.hint=void 0,this.localeId="en",this.errors=[],this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.step=void 0,this.placeholder=void 0,this.autocomplete=void 0,this.minimum=void 0,this.maximum=void 0,this.autoGrow=!1,this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(`input[id="${this.uid}"]`),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,readonly:this.readOnly,disabled:this.disabled,touched:this.touched}})})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}render(){super.render();const e=this.querySelector(`input[id="${this.uid}"]`),t={"min-width":"23px"};if(this.autoGrow)if(e){e.style.width="0px";const n=Math.max(23,e.scrollWidth);t.width=`${n}px`,t.maxWidth=`${n}px`,e.style.width=""}else t.width="47px";const i={uid:this.uid,label:this.label,hint:this.hint,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,step:this.step,placeholder:this.placeholder,autocomplete:this.autocomplete};return d.html`
|
|
1284
|
+
${le(this.uid,i)}
|
|
1285
|
+
|
|
1286
|
+
<div class="gui-widget">
|
|
1287
|
+
<button
|
|
1288
|
+
type="button"
|
|
1289
|
+
tabindex="-1"
|
|
1290
|
+
class="gui-button gui-number__minus"
|
|
1291
|
+
?disabled=${this.value<=this.minimum||this.disabled}
|
|
1292
|
+
@click=${this.minus}
|
|
1293
|
+
>
|
|
1294
|
+
-
|
|
1295
|
+
</button>
|
|
1296
|
+
|
|
1297
|
+
<input
|
|
1298
|
+
type="number"
|
|
1299
|
+
inputmode="decimal"
|
|
1300
|
+
id=${this.uid}
|
|
1301
|
+
data-cy=${`${this.uid}_number`}
|
|
1302
|
+
style=${Vt.styleMap(t)}
|
|
1303
|
+
value=${this.value}
|
|
1304
|
+
?required=${this.required}
|
|
1305
|
+
?disabled=${this.disabled}
|
|
1306
|
+
?readonly=${this.readOnly}
|
|
1307
|
+
step=${typeof this.step=="number"?this.step:d.nothing}
|
|
1308
|
+
placeholder=${this.placeholder||d.nothing}
|
|
1309
|
+
autocomplete=${this.autocomplete||d.nothing}
|
|
1310
|
+
@input=${this.valueChanged}
|
|
1311
|
+
@keydown=${this.keyDown}
|
|
1312
|
+
@blur=${this.onBlur}
|
|
1313
|
+
/>
|
|
1314
|
+
|
|
1315
|
+
<button
|
|
1316
|
+
type="button"
|
|
1317
|
+
tabindex="-1"
|
|
1318
|
+
class="gui-button gui-number__plus"
|
|
1319
|
+
?disabled=${this.value>=this.maximum||this.disabled}
|
|
1320
|
+
@click=${this.plus}
|
|
1321
|
+
>
|
|
1322
|
+
+
|
|
1323
|
+
</button>
|
|
1324
|
+
</div>
|
|
1325
|
+
|
|
1326
|
+
${V(this.uid,i)}
|
|
1327
|
+
`}keyDown(e){switch(e.stopPropagation(),e.key){case"ArrowUp":e.preventDefault(),this.plus();break;case"ArrowDown":e.preventDefault(),this.minus();break}}minus(){if(!this.readOnly){const e=this.querySelector(`input[id="${this.uid}"]`),t=typeof this.step=="number"?this.step:1;let i=Number(e.valueAsNumber)||Number(e.valueAsNumber)===0?e.valueAsNumber-t:1;i=Number(this.maximum)?Math.min(i,this.maximum):i,i=Number(this.minimum)?Math.max(i,this.minimum):i,e.valueAsNumber=i,this.value=i,this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value},bubbles:!0,composed:!0}))}}plus(){if(!this.readOnly){const e=this.querySelector(`input[id="${this.uid}"]`),t=typeof this.step=="number"?this.step:1;let i=Number(e.valueAsNumber)||Number(e.valueAsNumber)===0?e.valueAsNumber+t:1;i=Number(this.maximum)?Math.min(i,this.maximum):i,i=Number(this.minimum)?Math.max(i,this.minimum):i,e.valueAsNumber=i,this.value=i,this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value},bubbles:!0,composed:!0}))}}valueChanged(e){if(e.stopPropagation(),!this.readOnly){const t=e.target;this.dispatchEvent(new CustomEvent("input",{detail:{value:t.valueAsNumber},bubbles:!0,composed:!0}))}}onBlur(){this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0}))}};K([o.property({type:String})],q.prototype,"uid",2),K([o.property({type:String})],q.prototype,"label",2),K([o.property({type:String})],q.prototype,"hint",2),K([o.property({type:String,attribute:"locale-id"})],q.prototype,"localeId",2),K([o.property({type:Array})],q.prototype,"errors",2),K([o.property({type:Boolean})],q.prototype,"touched",2),K([o.property({type:Boolean})],q.prototype,"required",2),K([o.property({type:Boolean})],q.prototype,"disabled",2),K([o.property({type:Boolean,attribute:"readonly"})],q.prototype,"readOnly",2),K([o.property({type:Number})],q.prototype,"value",2),K([o.property({type:Number})],q.prototype,"step",2),K([o.property({type:String})],q.prototype,"placeholder",2),K([o.property({type:String})],q.prototype,"autocomplete",2),K([o.property({type:Number})],q.prototype,"minimum",2),K([o.property({type:Number})],q.prototype,"maximum",2),K([o.property({type:Number})],q.prototype,"autoGrow",2),q=K([o.customElement("gui-number")],q),typeof customElements<"u"&&!customElements.get("gui-number")&&customElements.define("gui-number",q);var nu=Object.defineProperty,su=Object.getOwnPropertyDescriptor,Di=(e,t,i,n)=>{for(var a=n>1?void 0:n?su(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&nu(t,i,a),a};let ft=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-number","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
522
1328
|
<gui-number
|
|
523
1329
|
.uid=${this.widget.uid}
|
|
524
1330
|
.label=${this.adapter.templateData.label}
|
|
@@ -538,7 +1344,38 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
538
1344
|
@input=${this.valueChanged}
|
|
539
1345
|
@blur=${()=>this.adapter.onBlur()}
|
|
540
1346
|
></gui-number>
|
|
541
|
-
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1347
|
+
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};Di([D.consume({context:y.formContext}),o.property({attribute:!1})],ft.prototype,"formContext",2),Di([D.provide({context:y.inputContext})],ft.prototype,"adapter",2),ft=Di([o.customElement("gui-number-input")],ft);const ru=Object.freeze(Object.defineProperty({__proto__:null,get NumberElement(){return ft}},Symbol.toStringTag,{value:"Module"}));function ou(e){const t=typeof e;return t==="string"||t==="number"}function za(e,t){return t.find(i=>i.value.toString()===e)?.value}const Fa=(e,t)=>{if(Array.isArray(e)&&e.length>0&&!Xe.isOption(e[0])){if(ou(e[0]))return e.map(i=>({label:i.toString(),value:i}));if(lu(e[0],t)){const i=du(e[0],t);return e.map(i)}else throw new Error("Invalid option shape")}return e},lu=(e,{labelField:t,valueField:i})=>{if(e===null||typeof e!="object")return!1;const n=e,a=t?Object.prototype.hasOwnProperty.call(n,t):!1,s=i?Object.prototype.hasOwnProperty.call(n,i):!1;return t&&!a?!1:!(i&&!s)};function du(e,{labelField:t,valueField:i}){if(e===null||typeof e!="object")throw new Error("Provided value is not an object");const n=e,a=t&&Object.prototype.hasOwnProperty.call(n,t)?t:void 0,s=i&&Object.prototype.hasOwnProperty.call(n,i)?i:void 0;if(!a&&!s)throw new Error("Neither labelField nor valueField exists on the object");return r=>{if(r===null||typeof r!="object")throw new Error("Item is not an object");const l=r;return{label:a?l[a]:"",value:s?l[s]:""}}}var uu=Object.defineProperty,pu=Object.getOwnPropertyDescriptor,se=(e,t,i,n)=>{for(var a=n>1?void 0:n?pu(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&uu(t,i,a),a};let J=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.localeId="en",this.errors=[],this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.hint=void 0,this.options=[],this.labelField=void 0,this.valueField=void 0,this.direction="column",this.optionsLoading=!1,this.hasMatchingValue=!1,this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(`input[name="${this.uid}"]`),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,touched:this.touched,readonly:!1,disabled:!1}})})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}render(){super.render();const e={uid:this.uid,label:this.label,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,hint:this.hint,options:this.options,labelField:this.labelField,valueField:this.valueField,direction:this.direction};this.options=Fa(this.options,{labelField:this.labelField,valueField:this.valueField});const t=this.value;this.hasMatchingValue=this.options?.length?this.options.find(({value:n})=>n===t)!==void 0:!1;const i=this.optionsLoading?d.html`<span>Loading...</span>`:d.html`
|
|
1348
|
+
${Q.repeat(this.options||[],n=>n?.value,(n,a)=>{const s=this.hasMatchingValue&&n.value===e.value,r=!this.hasMatchingValue&&a===0,l=s||r;return d.html`<label for=${`${this.uid}_${a}`}>
|
|
1349
|
+
<input
|
|
1350
|
+
type="radio"
|
|
1351
|
+
tabindex=${l?"0":"-1"}
|
|
1352
|
+
id=${`${this.uid}_${a}`}
|
|
1353
|
+
data-cy=${`${this.uid}_radiogroup_${a}`}
|
|
1354
|
+
name=${this.uid}
|
|
1355
|
+
value=${n.value}
|
|
1356
|
+
?checked=${s}
|
|
1357
|
+
?required=${e.required}
|
|
1358
|
+
?disabled=${e.disabled||e.readonly}
|
|
1359
|
+
@change=${this.valueChanged}
|
|
1360
|
+
@blur=${this.onBlur}
|
|
1361
|
+
/>
|
|
1362
|
+
${n.label}
|
|
1363
|
+
</label>`})}
|
|
1364
|
+
`;return d.html`
|
|
1365
|
+
${le(this.uid,e,!1,void 0,!1)}
|
|
1366
|
+
|
|
1367
|
+
<div
|
|
1368
|
+
class="gui-widget${this.direction==="row"?" gui-widget--horizontal":""}"
|
|
1369
|
+
role="radiogroup"
|
|
1370
|
+
id=${this.uid}
|
|
1371
|
+
aria-labelledby=${e.label?`${this.uid}_label`:d.nothing}
|
|
1372
|
+
aria-describedby=${e.hint?`${this.uid}_hint`:d.nothing}
|
|
1373
|
+
>
|
|
1374
|
+
${i}
|
|
1375
|
+
</div>
|
|
1376
|
+
|
|
1377
|
+
${V(this.uid,e)}
|
|
1378
|
+
`}valueChanged(e){if(e.stopPropagation(),!this.readOnly){const t=e.target;this.dispatchEvent(new CustomEvent("change",{detail:{value:za(t.value,this.options)},bubbles:!0,composed:!0}))}}onBlur(){this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0}))}};se([o.property({type:String})],J.prototype,"uid",2),se([o.property({type:String})],J.prototype,"label",2),se([o.property({type:String,attribute:"locale-id"})],J.prototype,"localeId",2),se([o.property({type:Array})],J.prototype,"errors",2),se([o.property({type:Boolean})],J.prototype,"touched",2),se([o.property({type:Boolean})],J.prototype,"required",2),se([o.property({type:Boolean})],J.prototype,"disabled",2),se([o.property({type:Boolean,attribute:"readonly"})],J.prototype,"readOnly",2),se([o.property({type:String})],J.prototype,"value",2),se([o.property({type:String})],J.prototype,"hint",2),se([o.property({type:String})],J.prototype,"options",2),se([o.property({type:String})],J.prototype,"labelField",2),se([o.property({type:String})],J.prototype,"valueField",2),se([o.property({type:String})],J.prototype,"direction",2),J=se([o.customElement("gui-radiogroup")],J),typeof customElements<"u"&&!customElements.get("gui-radiogroup")&&customElements.define("gui-radiogroup",J);var cu=Object.defineProperty,hu=Object.getOwnPropertyDescriptor,bi=(e,t,i,n)=>{for(var a=n>1?void 0:n?hu(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&cu(t,i,a),a};let gt=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-radiogroup","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
542
1379
|
<gui-radiogroup
|
|
543
1380
|
.uid=${this.widget.uid}
|
|
544
1381
|
.label=${this.adapter.templateData.label}
|
|
@@ -556,7 +1393,44 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
556
1393
|
@change=${this.valueChanged}
|
|
557
1394
|
@blur=${()=>this.adapter.onBlur()}
|
|
558
1395
|
></gui-radiogroup>
|
|
559
|
-
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1396
|
+
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};bi([D.consume({context:y.formContext}),o.property({attribute:!1})],gt.prototype,"formContext",2),bi([D.provide({context:y.inputContext})],gt.prototype,"adapter",2),gt=bi([o.customElement("gui-radiogroup-input")],gt);const mu=Object.freeze(Object.defineProperty({__proto__:null,get RadiogroupElement(){return gt}},Symbol.toStringTag,{value:"Module"}));var yu=Object.defineProperty,fu=Object.getOwnPropertyDescriptor,X=(e,t,i,n)=>{for(var a=n>1?void 0:n?fu(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&yu(t,i,a),a};let B=class extends d.LitElement{constructor(){super(...arguments),this.uid=void 0,this.label=void 0,this.localeId="en",this.errors=[],this.touched=!1,this.required=!1,this.disabled=!1,this.readOnly=!1,this.value=void 0,this.hint=void 0,this.icon=void 0,this.autocomplete=void 0,this.options=[],this.placeholder=void 0,this.labelField=void 0,this.valueField=void 0,this.optionsLoading=!1,this.hasMatchingValue=!1,this.ariaController=new oe(this,{getTargets:()=>this.querySelectorAll(`select[id="${this.uid}"]`),getState:()=>({uid:this.uid,templateData:{hint:this.hint,errors:this.errors,readonly:this.readOnly,disabled:this.disabled,touched:this.touched}})})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("gui-field")}render(){super.render();const e={uid:this.uid,label:this.label,errors:this.errors,touched:this.touched,required:this.required,disabled:this.disabled,readonly:this.readOnly,value:this.value,hint:this.hint,icon:this.icon,autocomplete:this.autocomplete,options:this.options,placeholder:this.placeholder,labelField:this.labelField,valueField:this.valueField},t=Fe("select",e);this.options=Fa(this.options,{labelField:this.labelField,valueField:this.valueField}),this.hasMatchingValue=this.options?.length?this.options.find(({value:n})=>n===this.value)!==void 0:!1;const i=this.optionsLoading?d.html`<span>Loading...</span>`:d.html`
|
|
1397
|
+
<option value="" disabled selected=${this.hasMatchingValue?d.nothing:""}>
|
|
1398
|
+
${this.placeholder??"Select an option"}
|
|
1399
|
+
</option>
|
|
1400
|
+
${Q.repeat(this.options||[],n=>n?.value,n=>d.html`<option
|
|
1401
|
+
value=${n.value}
|
|
1402
|
+
selected=${this.hasMatchingValue&&n.value===this.value?"":d.nothing}
|
|
1403
|
+
>
|
|
1404
|
+
${n.label}
|
|
1405
|
+
</option>`)}
|
|
1406
|
+
`;return d.html`
|
|
1407
|
+
${le(this.uid,e)}
|
|
1408
|
+
|
|
1409
|
+
<div class="gui-widget">
|
|
1410
|
+
<select
|
|
1411
|
+
id=${this.uid}
|
|
1412
|
+
tabindex="0"
|
|
1413
|
+
data-cy=${`${this.uid}_select`}
|
|
1414
|
+
class=${$.classMap(t.widgetClasses)}
|
|
1415
|
+
?required=${e.required}
|
|
1416
|
+
?disabled=${e.disabled||e.readonly}
|
|
1417
|
+
autocomplete=${this.autocomplete||d.nothing}
|
|
1418
|
+
@change=${this.valueChanged}
|
|
1419
|
+
@blur=${this.onBlur}
|
|
1420
|
+
>
|
|
1421
|
+
${i}
|
|
1422
|
+
</select>
|
|
1423
|
+
<span class="gui-select__arrow"
|
|
1424
|
+
><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256">
|
|
1425
|
+
<path
|
|
1426
|
+
d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"
|
|
1427
|
+
></path></svg
|
|
1428
|
+
></span>
|
|
1429
|
+
${t.html}
|
|
1430
|
+
</div>
|
|
1431
|
+
|
|
1432
|
+
${V(this.uid,e)}
|
|
1433
|
+
`}updated(e){e.has("value")&&!this.hasMatchingValue&&this.value&&this.dispatchEvent(new CustomEvent("inputError",{detail:{message:`Invalid selection: '${this.value}' is not a valid option.`},bubbles:!0}))}valueChanged(e){if(e.stopPropagation(),!this.readOnly){const t=e.target;this.dispatchEvent(new CustomEvent("change",{detail:{value:za(t.value,this.options)},bubbles:!0,composed:!0}))}}onBlur(){this.dispatchEvent(new CustomEvent("blur",{bubbles:!0,composed:!0}))}};X([o.property({type:String})],B.prototype,"uid",2),X([o.property({type:String})],B.prototype,"label",2),X([o.property({type:String,attribute:"locale-id"})],B.prototype,"localeId",2),X([o.property({type:Array})],B.prototype,"errors",2),X([o.property({type:Boolean})],B.prototype,"touched",2),X([o.property({type:Boolean})],B.prototype,"required",2),X([o.property({type:Boolean})],B.prototype,"disabled",2),X([o.property({type:Boolean,attribute:"readonly"})],B.prototype,"readOnly",2),X([o.property({type:String})],B.prototype,"value",2),X([o.property({type:String})],B.prototype,"hint",2),X([o.property({type:String})],B.prototype,"icon",2),X([o.property({type:String})],B.prototype,"autocomplete",2),X([o.property({type:String})],B.prototype,"options",2),X([o.property({type:String})],B.prototype,"placeholder",2),X([o.property({type:String})],B.prototype,"labelField",2),X([o.property({type:String})],B.prototype,"valueField",2),B=X([o.customElement("gui-select")],B),typeof customElements<"u"&&!customElements.get("gui-select")&&customElements.define("gui-select",B);var gu=Object.defineProperty,Du=Object.getOwnPropertyDescriptor,vi=(e,t,i,n)=>{for(var a=n>1?void 0:n?Du(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&gu(t,i,a),a};let Dt=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-select","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return super.render(),d.html`
|
|
560
1434
|
<gui-select
|
|
561
1435
|
.uid=${this.widget.uid}
|
|
562
1436
|
.label=${this.adapter.templateData.label}
|
|
@@ -577,7 +1451,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
577
1451
|
@inputError=${this.onInputError}
|
|
578
1452
|
@blur=${()=>this.adapter.onBlur()}
|
|
579
1453
|
></gui-select>
|
|
580
|
-
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}onInputError(e){this.adapter.injectValidationIssues([e.detail.message])}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1454
|
+
`}valueChanged(e){const t=e.detail.value;this.adapter.valueChanged(t)}onInputError(e){this.adapter.injectValidationIssues([e.detail.message])}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};vi([D.consume({context:y.formContext}),o.property({attribute:!1})],Dt.prototype,"formContext",2),vi([D.provide({context:y.inputContext})],Dt.prototype,"adapter",2),Dt=vi([o.customElement("gui-select-input")],Dt);const bu=Object.freeze(Object.defineProperty({__proto__:null,get SelectElement(){return Dt}},Symbol.toStringTag,{value:"Module"}));var vu=Object.defineProperty,wu=Object.getOwnPropertyDescriptor,bt=(e,t,i,n)=>{for(var a=n>1?void 0:n?wu(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&vu(t,i,a),a};let $u=0;const ku=()=>$u++;let qe=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.InputWidgetAdapter,this.isFocused=!1,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-repeater","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}onFocusIn(e){e.stopPropagation(),this.isFocused=!0}onFocusOut(e){e.stopPropagation(),this.adapter.onBlur(),this.isFocused=!1}render(){const e=this.adapter.templateData,t=e.touched&&e.errors&&e.errors.length>0;return d.html`
|
|
581
1455
|
<div
|
|
582
1456
|
id=${this.widget.uid}
|
|
583
1457
|
class=${`gui-repeater__main-card gui-repeater__card ${this.isFocused?"gui-repeater__card--focused":""}`}
|
|
@@ -593,31 +1467,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
593
1467
|
.required=${e.validator?.required}
|
|
594
1468
|
.native=${!1}
|
|
595
1469
|
></gui-label>
|
|
596
|
-
${e.value?
|
|
1470
|
+
${e.value?Q.repeat(e.value,i=>Zn(i,ku),(i,n)=>d.html`
|
|
597
1471
|
<div class="gui-repeater__card">
|
|
598
1472
|
<div class="gui-repeater__card-header">
|
|
599
|
-
${e.title?
|
|
600
|
-
>${e.title} ${
|
|
601
|
-
>`:
|
|
1473
|
+
${e.title?d.html`<span class="gui-repeater__card-title"
|
|
1474
|
+
>${e.title} ${n+1}</span
|
|
1475
|
+
>`:d.nothing}
|
|
602
1476
|
<button
|
|
603
1477
|
type="button"
|
|
604
1478
|
tabindex="0"
|
|
605
1479
|
class="gui-button gui-button--sm gui-repeater__remove-btn"
|
|
606
|
-
@click=${()=>this.removeItem(
|
|
1480
|
+
@click=${()=>this.removeItem(n)}
|
|
607
1481
|
>
|
|
608
|
-
${e.removeButtonIcon?
|
|
1482
|
+
${e.removeButtonIcon?d.html`<span
|
|
609
1483
|
class="gui-widget-icon gui-button-icon ${e.removeButtonIcon}"
|
|
610
1484
|
data-icon=${e.removeButtonIcon}
|
|
611
|
-
></span>`:
|
|
1485
|
+
></span>`:d.nothing}
|
|
612
1486
|
${e.removeLabel??"Remove"}
|
|
613
1487
|
</button>
|
|
614
1488
|
</div>
|
|
615
1489
|
<gui-repeater-widget
|
|
616
|
-
.repeaterIndex=${
|
|
1490
|
+
.repeaterIndex=${n}
|
|
617
1491
|
.widget=${e.template}
|
|
618
1492
|
></gui-repeater-widget>
|
|
619
1493
|
</div>
|
|
620
|
-
`):
|
|
1494
|
+
`):d.nothing}
|
|
621
1495
|
|
|
622
1496
|
<button
|
|
623
1497
|
type="button"
|
|
@@ -626,68 +1500,68 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
626
1500
|
@click=${()=>this.addItem()}
|
|
627
1501
|
?disabled=${!!(e.limit&&e.limit===e.value?.length)}
|
|
628
1502
|
>
|
|
629
|
-
${e.addButtonIcon?
|
|
1503
|
+
${e.addButtonIcon?d.html`<span
|
|
630
1504
|
class="gui-widget-icon gui-button-icon ${e.addButtonIcon}"
|
|
631
1505
|
data-icon=${e.addButtonIcon}
|
|
632
|
-
></span>`:
|
|
1506
|
+
></span>`:d.nothing}
|
|
633
1507
|
${e.addLabel??"Add"}
|
|
634
1508
|
</button>
|
|
635
1509
|
</div>
|
|
636
|
-
${t?
|
|
1510
|
+
${t?d.html`<gui-errors
|
|
637
1511
|
.uid=${this.widget.uid}
|
|
638
1512
|
.errors=${e.errors}
|
|
639
1513
|
.touched=${e.touched}
|
|
640
|
-
></gui-errors>`:
|
|
641
|
-
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}addItem(){const e=[...this.adapter.templateData.value??[],{}];this.adapter.valueChanged(e),this.requestUpdate()}removeItem(e){const t=(this.adapter.templateData.value??[]).filter((
|
|
1514
|
+
></gui-errors>`:d.nothing}
|
|
1515
|
+
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}addItem(){const e=[...this.adapter.templateData.value??[],{}];this.adapter.valueChanged(e),this.requestUpdate()}removeItem(e){const t=(this.adapter.templateData.value??[]).filter((i,n)=>e!==n);"structuredClone"in window?this.adapter.valueChanged(structuredClone(t)):this.adapter.valueChanged(JSON.parse(JSON.stringify(t))),this.requestUpdate()}};bt([D.consume({context:y.formContext}),o.property({attribute:!1})],qe.prototype,"formContext",2),bt([D.provide({context:y.inputContext})],qe.prototype,"adapter",2),bt([o.state()],qe.prototype,"isFocused",2),bt([o.query(".gui-repeater__main-card")],qe.prototype,"_repeaterRef",2),qe=bt([o.customElement("gui-repeater-input")],qe);const _u=Object.freeze(Object.defineProperty({__proto__:null,get RepeaterElement(){return qe}},Symbol.toStringTag,{value:"Module"}));var Cu=Object.defineProperty,Su=Object.getOwnPropertyDescriptor,wi=(e,t,i,n)=>{for(var a=n>1?void 0:n?Su(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Cu(t,i,a),a};let vt=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.LayoutWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-flex","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){const e={"gui-flex__widget":!0,"gui-flex__widget--row":this.adapter.templateData.direction==="row","gui-flex__widget--row-reverse":this.adapter.templateData.direction==="row-reverse","gui-flex__widget--column":!this.adapter.templateData.direction||this.adapter.templateData.direction==="column","gui-flex__widget--column-reverse":this.adapter.templateData.direction==="column-reverse","gui-flex__widget--justify-center":this.adapter.templateData.justify==="center","gui-flex__widget--justify-start":this.adapter.templateData.justify==="start","gui-flex__widget--justify-end":this.adapter.templateData.justify==="end","gui-flex__widget--justify-stretch":!this.adapter.templateData.justify||this.adapter.templateData.justify==="stretch","gui-flex__widget--align-start":!this.adapter.templateData.align||this.adapter.templateData.align==="start","gui-flex__widget--align-end":this.adapter.templateData.align==="end","gui-flex__widget--align-center":this.adapter.templateData.align==="center","gui-flex__widget--align-space-between":this.adapter.templateData.align==="space-between","gui-flex__widget--align-space-around":this.adapter.templateData.align==="space-around","gui-flex__widget--align-space-evenly":this.adapter.templateData.align==="space-evenly"};return d.html`
|
|
642
1516
|
<div
|
|
643
|
-
class=${
|
|
1517
|
+
class=${$.classMap(e)}
|
|
644
1518
|
id=${this.widget?.uid}
|
|
645
1519
|
style=${this.adapter.templateData.gap?`gap: ${this.adapter.templateData.gap}px`:""}
|
|
646
1520
|
>
|
|
647
|
-
${
|
|
1521
|
+
${Q.repeat(this.adapter.templateData.children||[],t=>t?.uid,t=>d.html`<gui-widget .widget=${t}></gui-widget>`)}
|
|
648
1522
|
</div>
|
|
649
|
-
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
650
|
-
<div class=${
|
|
651
|
-
${
|
|
652
|
-
<gui-widget .widget=${
|
|
1523
|
+
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};wi([D.consume({context:y.formContext}),o.property({attribute:!1})],vt.prototype,"formContext",2),wi([D.provide({context:y.layoutContext})],vt.prototype,"adapter",2),vt=wi([o.customElement("gui-flex-layout")],vt);const Ou=Object.freeze(Object.defineProperty({__proto__:null,get FlexElement(){return vt}},Symbol.toStringTag,{value:"Module"}));var xu=Object.defineProperty,Eu=Object.getOwnPropertyDescriptor,$i=(e,t,i,n)=>{for(var a=n>1?void 0:n?Eu(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&xu(t,i,a),a};let wt=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.LayoutWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-grid","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){const e=this.adapter.templateData.direction==="column",t=!e,i=this.adapter.templateData.autoFit??!0,n={"gui-grid__widget":!0,"gui-grid__widget--row":t,"gui-grid__widget--row--auto-fit":t&&i,"gui-grid__widget--column":e,"gui-grid__widget--align-center":this.adapter.templateData.align==="center","gui-grid__widget--align-start":this.adapter.templateData.align==="start","gui-grid__widget--align-end":this.adapter.templateData.align==="end","gui-grid__widget--align-space-between":this.adapter.templateData.align==="space-between","gui-grid__widget--align-space-around":this.adapter.templateData.align==="space-around","gui-grid__widget--align-space-evenly":this.adapter.templateData.align==="space-evenly","gui-grid__widget--align-stretch":!this.adapter.templateData.align||this.adapter.templateData.align==="stretch","gui-grid__widget--justify-center":this.adapter.templateData.justify==="center","gui-grid__widget--justify-start":this.adapter.templateData.justify==="start","gui-grid__widget--justify-end":this.adapter.templateData.justify==="end","gui-grid__widget--justify-stretch":this.adapter.templateData.justify==="stretch"},a=[];return this.adapter.templateData.columnGap!==void 0&&a.push(`column-gap: ${this.adapter.templateData.columnGap}px`),this.adapter.templateData.rowGap!==void 0&&a.push(`row-gap: ${this.adapter.templateData.rowGap}px`),d.html`
|
|
1524
|
+
<div class=${$.classMap(n)} id=${this.widget?.uid} style=${a.join("; ")}>
|
|
1525
|
+
${Q.repeat(this.adapter.templateData.children||[],s=>s?.uid,s=>d.html`<div class="gui-grid__cell" style="grid-column: span ${s.size||1}">
|
|
1526
|
+
<gui-widget .widget=${s}></gui-widget>
|
|
653
1527
|
</div>`)}
|
|
654
1528
|
</div>
|
|
655
|
-
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}}
|
|
1529
|
+
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};$i([D.consume({context:y.formContext}),o.property({attribute:!1})],wt.prototype,"formContext",2),$i([D.provide({context:y.layoutContext})],wt.prototype,"adapter",2),wt=$i([o.customElement("gui-grid-layout")],wt);const Pu=Object.freeze(Object.defineProperty({__proto__:null,get GridElement(){return wt}},Symbol.toStringTag,{value:"Module"}));var Iu=Object.defineProperty,Au=Object.getOwnPropertyDescriptor,Pe=(e,t,i,n)=>{for(var a=n>1?void 0:n?Au(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Iu(t,i,a),a};let $e=class extends d.LitElement{constructor(){super(...arguments),this.activeTab="",this.adapter=new y.LayoutWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-tabs","gui-field");const e=this.widget.props;this.adapter.context=this.formContext,this.adapter.init(this.widget),this.activeTab=e.defaultOpen??e.tabs[0].uid,this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>{this.requestUpdate()}))}firstUpdated(e){this.startObserver=Ye(this.startSentinel,n=>this.isStartVisible=n),this.endObserver=Ye(this.endSentinel,n=>this.isEndVisible=n);const i=this.widget.props.tabs.findIndex(n=>n.uid===this.activeTab);this.tabButtons[i].scrollIntoView({block:"nearest",inline:"nearest"})}render(){if(!this.adapter.templateData)return d.html``;const e=this.widget.children.filter(i=>i.uid===this.activeTab||this.adapter.templateData.renderMode!=="activeOnly"),t={"gui-widget":!0,"gui-widget--horizontal":!0,"gui-tabs--start-shadow":!this.isStartVisible,"gui-tabs--end-shadow":!this.isEndVisible};return d.html`<nav class=${$.classMap(t)} id=${this.widget.uid}>
|
|
656
1530
|
<ul role="tablist">
|
|
657
1531
|
<li role="presentation" id="start-sentinel" class="gui-sentinel"></li>
|
|
658
|
-
${this.adapter.templateData.tabs?
|
|
1532
|
+
${this.adapter.templateData.tabs?Q.repeat(this.adapter.templateData.tabs,(i,n)=>d.html`
|
|
659
1533
|
<li role="presentation">
|
|
660
1534
|
<button
|
|
661
1535
|
type="button"
|
|
662
1536
|
role="tab"
|
|
663
|
-
tabindex=${
|
|
664
|
-
data-cy=${`tab_${this.widget.uid}_${
|
|
665
|
-
id=${`tab_${this.widget.uid}_${
|
|
666
|
-
aria-controls=${`tabpanel_${this.widget.uid}_${
|
|
667
|
-
aria-selected=${
|
|
668
|
-
class=${
|
|
669
|
-
@click=${()=>this.onClickTab(
|
|
1537
|
+
tabindex=${i.uid===this.activeTab?"0":"-1"}
|
|
1538
|
+
data-cy=${`tab_${this.widget.uid}_${n}`}
|
|
1539
|
+
id=${`tab_${this.widget.uid}_${n}`}
|
|
1540
|
+
aria-controls=${`tabpanel_${this.widget.uid}_${n}`}
|
|
1541
|
+
aria-selected=${i.uid===this.activeTab?"true":"false"}
|
|
1542
|
+
class=${$.classMap({active:i.uid===this.activeTab})}
|
|
1543
|
+
@click=${()=>this.onClickTab(i.uid)}
|
|
670
1544
|
@keydown=${this.onKeyDown}
|
|
671
|
-
@focus=${
|
|
1545
|
+
@focus=${a=>a.target.scrollIntoView({block:"nearest",inline:"nearest"})}
|
|
672
1546
|
>
|
|
673
|
-
${
|
|
1547
|
+
${i.label}
|
|
674
1548
|
</button>
|
|
675
1549
|
</li>
|
|
676
|
-
`):
|
|
1550
|
+
`):d.nothing}
|
|
677
1551
|
<li role="presentation" id="end-sentinel" class="gui-sentinel gui-sentinel__end"></li>
|
|
678
1552
|
</ul>
|
|
679
1553
|
</nav>
|
|
680
|
-
${
|
|
1554
|
+
${Q.repeat(e,i=>i?.uid,(i,n)=>d.html`<section
|
|
681
1555
|
role="tabpanel"
|
|
682
|
-
data-cy=${`tabpanel_${this.widget.uid}_${
|
|
683
|
-
id=${`tabpanel_${this.widget.uid}_${
|
|
684
|
-
?hidden=${
|
|
685
|
-
aria-labelledby=${`tab_${this.widget.uid}_${
|
|
1556
|
+
data-cy=${`tabpanel_${this.widget.uid}_${n}`}
|
|
1557
|
+
id=${`tabpanel_${this.widget.uid}_${n}`}
|
|
1558
|
+
?hidden=${i.uid!==this.activeTab&&this.adapter.templateData.renderMode!=="activeOnly"}
|
|
1559
|
+
aria-labelledby=${`tab_${this.widget.uid}_${n}`}
|
|
686
1560
|
>
|
|
687
|
-
<gui-widget .widget=${
|
|
688
|
-
</section>`)}`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe()),this.startObserver?.disconnect(),this.endObserver?.disconnect()}onClickTab(e){this.activeTab=e,this.adapter.change(e),this.requestUpdate()}onKeyDown(e){const t=this.widget.props.tabs,
|
|
1561
|
+
<gui-widget .widget=${i}></gui-widget>
|
|
1562
|
+
</section>`)}`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe()),this.startObserver?.disconnect(),this.endObserver?.disconnect()}onClickTab(e){this.activeTab=e,this.adapter.change(e),this.requestUpdate()}onKeyDown(e){const t=this.widget.props.tabs,i=t.findIndex(s=>s.uid===this.activeTab),n=Array.from(this.tabButtons),a=window.getComputedStyle(this).direction==="rtl";switch(e.key){case"ArrowLeft":{const s=i+(a?1:-1);s>=0&&s<t.length&&(this.activeTab=t[s].uid,n[s].focus());break}case"ArrowRight":{const s=i+(a?-1:1);s>=0&&s<t.length&&(this.activeTab=t[s].uid,n[s].focus());break}case"Home":this.activeTab=t[0].uid,n[0].focus();break;case"End":this.activeTab=t[t.length-1].uid,n[t.length-1].focus();break;default:return}}};Pe([o.query("#start-sentinel")],$e.prototype,"startSentinel",2),Pe([o.query("#end-sentinel")],$e.prototype,"endSentinel",2),Pe([o.state()],$e.prototype,"isStartVisible",2),Pe([o.state()],$e.prototype,"isEndVisible",2),Pe([o.queryAll('button[role="tab"]')],$e.prototype,"tabButtons",2),Pe([o.property({type:String})],$e.prototype,"activeTab",2),Pe([D.consume({context:y.formContext}),o.property({attribute:!1})],$e.prototype,"formContext",2),Pe([D.provide({context:y.layoutContext})],$e.prototype,"adapter",2),$e=Pe([o.customElement("gui-tabs-layout")],$e);const Tu=Object.freeze(Object.defineProperty({__proto__:null,get TabsElement(){return $e}},Symbol.toStringTag,{value:"Module"}));var Lu=Object.defineProperty,Mu=Object.getOwnPropertyDescriptor,ki=(e,t,i,n)=>{for(var a=n>1?void 0:n?Mu(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Lu(t,i,a),a};let $t=class extends d.LitElement{constructor(){super(...arguments),this.activeSections={},this.adapter=new y.LayoutWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-accordion","gui-field");const e=this.widget.props;this.adapter.context=this.formContext,this.adapter.init(this.widget),this.activeSections=e.defaultOpen??{},this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}onClickButton(e){this.widget.props.singleOpen&&Object.keys(this.activeSections).filter(i=>i!==e).forEach(i=>{this.activeSections[i]=!1}),this.activeSections[e]=!this.activeSections[e],this.adapter.change(this.activeSections),this.requestUpdate()}getChild(e){return this.widget.children.find(t=>t.uid===e)}render(){return this.adapter.templateData?d.html`
|
|
689
1563
|
<div class="gui-widget" id=${this.widget.uid}>
|
|
690
|
-
${this.adapter.templateData.sections?
|
|
1564
|
+
${this.adapter.templateData.sections?Q.repeat(this.adapter.templateData.sections,e=>e.uid,e=>{const t=this.activeSections[e.uid]||this.adapter.templateData.renderMode!=="activeOnly"?d.html`<section
|
|
691
1565
|
class="gui-widget"
|
|
692
1566
|
role="region"
|
|
693
1567
|
id=${`accordion_section_${e.uid}`}
|
|
@@ -695,11 +1569,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
695
1569
|
aria-labelledby=${`accordion_button_${e.uid}`}
|
|
696
1570
|
>
|
|
697
1571
|
<gui-widget .widget=${this.getChild(e.uid)}></gui-widget>
|
|
698
|
-
</section>`:
|
|
1572
|
+
</section>`:d.nothing;return d.html`<div class="gui-accordion__section">
|
|
699
1573
|
<button
|
|
700
1574
|
type="button"
|
|
701
1575
|
tabindex="0"
|
|
702
|
-
class=${
|
|
1576
|
+
class=${$.classMap({active:this.activeSections[e.uid]})}
|
|
703
1577
|
id=${`accordion_button_${e.uid}`}
|
|
704
1578
|
aria-controls=${`accordion_section_${e.uid}`}
|
|
705
1579
|
aria-expanded=${this.activeSections[e.uid]?"true":"false"}
|
|
@@ -719,9 +1593,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
719
1593
|
</button>
|
|
720
1594
|
|
|
721
1595
|
${t}
|
|
722
|
-
</div>`}):
|
|
1596
|
+
</div>`}):d.nothing}
|
|
723
1597
|
</div>
|
|
724
|
-
`:
|
|
1598
|
+
`:d.html``}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};ki([D.consume({context:y.formContext}),o.property({attribute:!1})],$t.prototype,"formContext",2),ki([D.provide({context:y.layoutContext})],$t.prototype,"adapter",2),$t=ki([o.customElement("gui-accordion-layout")],$t);const zu=Object.freeze(Object.defineProperty({__proto__:null,get AccordionElement(){return $t}},Symbol.toStringTag,{value:"Module"}));var Fu=Object.defineProperty,Ru=Object.getOwnPropertyDescriptor,_i=(e,t,i,n)=>{for(var a=n>1?void 0:n?Ru(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Fu(t,i,a),a};let kt=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.DisplayWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-alert","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return d.html`
|
|
725
1599
|
<div class="gui-widget" id=${this.widget.uid}>
|
|
726
1600
|
<div
|
|
727
1601
|
role="alert"
|
|
@@ -730,13 +1604,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
730
1604
|
${this.adapter.templateData.text}
|
|
731
1605
|
</div>
|
|
732
1606
|
</div>
|
|
733
|
-
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1607
|
+
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};_i([D.consume({context:y.formContext}),o.property({attribute:!1})],kt.prototype,"formContext",2),_i([D.provide({context:y.displayWidgetContext})],kt.prototype,"adapter",2),kt=_i([o.customElement("gui-alert-display")],kt);const Nu=Object.freeze(Object.defineProperty({__proto__:null,get AlertElement(){return kt}},Symbol.toStringTag,{value:"Module"}));var qu=Object.defineProperty,Bu=Object.getOwnPropertyDescriptor,Ci=(e,t,i,n)=>{for(var a=n>1?void 0:n?Bu(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&qu(t,i,a),a};let _t=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.DisplayWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-markdown-text","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return d.html`
|
|
734
1608
|
<div class="gui-widget" id=${this.widget.uid}>
|
|
735
1609
|
<gui-markdown-text
|
|
736
1610
|
.md=${this.adapter.templateData.md}
|
|
737
1611
|
.dependencies=${this.adapter.templateData.deps}
|
|
738
1612
|
></gui-markdown-text>
|
|
739
1613
|
</div>
|
|
740
|
-
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1614
|
+
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};Ci([D.consume({context:y.formContext}),o.property({attribute:!1})],_t.prototype,"formContext",2),Ci([D.provide({context:y.displayWidgetContext})],_t.prototype,"adapter",2),_t=Ci([o.customElement("gui-markdown-text-display")],_t);const Zu=Object.freeze(Object.defineProperty({__proto__:null,get MarkdownTextElement(){return _t}},Symbol.toStringTag,{value:"Module"}));var Vu=Object.defineProperty,Uu=Object.getOwnPropertyDescriptor,Si=(e,t,i,n)=>{for(var a=n>1?void 0:n?Uu(t,i):t,s=e.length-1,r;s>=0;s--)(r=e[s])&&(a=(n?r(t,i,a):r(a))||a);return n&&a&&Vu(t,i,a),a};let Ct=class extends d.LitElement{constructor(){super(...arguments),this.adapter=new y.DisplayWidgetAdapter,this.subscriptions=[]}createRenderRoot(){return this}updated(e){super.updated(e);const t=this.adapter.templateData.size;t?this.style.flex=String(t):this.style.removeProperty("flex")}connectedCallback(){super.connectedCallback(),this.classList.add("gui-renderer","gui-field"),this.adapter.context=this.formContext,this.adapter.init(this.widget),this.subscriptions.push(this.adapter.templateDataChanged$.subscribe(()=>this.requestUpdate()))}render(){return d.html`
|
|
741
1615
|
<div class="gui-widget" id=${this.widget.uid}>${this.adapter.templateData.render}</div>
|
|
742
|
-
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};
|
|
1616
|
+
`}disconnectedCallback(){super.disconnectedCallback(),this.adapter.destroy(),this.subscriptions.forEach(e=>e.unsubscribe())}};Si([D.consume({context:y.formContext}),o.property({attribute:!1})],Ct.prototype,"formContext",2),Si([D.provide({context:y.displayWidgetContext})],Ct.prototype,"adapter",2),Ct=Si([o.customElement("gui-renderer-component")],Ct);const Wu=Object.freeze(Object.defineProperty({__proto__:null,get RendererElement(){return Ct}},Symbol.toStringTag,{value:"Module"}));S.widgetLoaders=Pi,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
|