@reformer/builder 3.0.0-beta.7 → 3.0.0-beta.8
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/bin/reformer-builder.mjs +1 -1
- package/dist/assets/css/index-CHjtwIsF.css +1 -0
- package/dist/assets/i18n/en-uNov8AYL.js +1 -0
- package/dist/assets/i18n/ru-BNkTKaU6.js +1 -0
- package/dist/assets/js/index-C4LjLCAZ.js +57 -0
- package/dist/assets/monaco/html-DT-eqvPn.js +1 -0
- package/dist/assets/monaco/javascript-CIJHG94Q.js +1 -0
- package/dist/assets/monaco/{jsonMode-C3DAkvde.js → jsonMode-rEmNPnut.js} +3 -3
- package/dist/assets/monaco/{monaco-runtime-DNdOZY7f.js → monaco-runtime-Dqtu7Dpv.js} +137 -137
- package/dist/assets/monaco/typescript-Bp6doald.js +1 -0
- package/dist/assets/monaco/xml-D8D5UF1F.js +1 -0
- package/dist/assets/monaco/yaml-DsiyZy1w.js +1 -0
- package/dist/assets/plugins/{ai-jKAVkXuU.js → ai-CFoGZBd-.js} +36 -36
- package/dist/assets/plugins/{ai-byok-DgeZQTZb.js → ai-byok-a7JlkizL.js} +1 -1
- package/dist/assets/plugins/ai-knowledge-docs-BcbN7Ar1.js +1 -0
- package/dist/assets/plugins/ai-knowledge-index-CncxmxEf.js +1 -0
- package/dist/assets/plugins/codegen-DPh2ynzq.js +520 -0
- package/dist/assets/plugins/{editor-markdown-MarkdownPreview-DyHZvj8H.js → editor-markdown-MarkdownPreview-CjVpNIV5.js} +3 -3
- package/dist/assets/plugins/editor-markdown-McTrLzET.js +2 -0
- package/dist/assets/plugins/editor-monaco-7BM478IS.js +14 -0
- package/dist/assets/plugins/editor-schema-DOoRcy16.js +4 -0
- package/dist/assets/plugins/files-WhQya3nC.js +2 -0
- package/dist/assets/plugins/plain-4ISpXJVh.js +78 -0
- package/dist/assets/plugins/plugin-manager-Ek0Ph0Jj.js +1 -0
- package/dist/assets/plugins/preview-BSh_puVw.js +1 -0
- package/dist/assets/plugins/preview-runtime-B8NzDg53.js +3 -0
- package/dist/assets/plugins/templates-BE9B0S3J.js +2 -0
- package/dist/assets/vendor/{ajv-CCplthOF.js → ajv-N5zGp_lm.js} +1 -1
- package/dist/assets/vendor/calendar-base-BW48REpD-BYc4qqRC.js +1 -0
- package/dist/assets/vendor/carousel-BDyy29mt.js +1 -0
- package/dist/assets/vendor/chart-Cbp9J5YJ.js +52 -0
- package/dist/assets/vendor/collapsible-base-DZxAKbAF-DtQ4867U.js +1 -0
- package/dist/assets/vendor/drawer-BdLrIIeu.js +3 -0
- package/dist/assets/vendor/highlight.js/{common-g0-hl6Ud.js → common-B96EybDa.js} +1 -1
- package/dist/assets/vendor/index-BTAoX623.js +6 -0
- package/dist/assets/vendor/index-D8ACoUqy.js +51 -0
- package/dist/assets/vendor/input-otp-BoPlZ6dt.js +20 -0
- package/dist/assets/vendor/lucide-react/arrow-left-BlVPt6Ag.js +1 -0
- package/dist/assets/vendor/lucide-react/arrow-right-I5ntlq0-.js +1 -0
- package/dist/assets/vendor/lucide-react/calendar-L-57WZlQ.js +1 -0
- package/dist/assets/vendor/lucide-react/eye-DVTIIHcH.js +1 -0
- package/dist/assets/vendor/lucide-react/file-code-corner-DUfMS_yi.js +1 -0
- package/dist/assets/vendor/lucide-react/folder-tree-COyCkaDl.js +1 -0
- package/dist/assets/vendor/lucide-react/minus-zJRYKuAo.js +1 -0
- package/dist/assets/vendor/lucide-react/plus-B0WG2JcM.js +1 -0
- package/dist/assets/vendor/lucide-react/rotate-ccw-BSYk0mux.js +1 -0
- package/dist/assets/vendor/lucide-react/wrench-mybFdWHD.js +1 -0
- package/dist/assets/vendor/message-base-B5jT1FuY-BvDKjuSs.js +1 -0
- package/dist/assets/vendor/message-scroller-B2tlOtxT.js +1 -0
- package/dist/assets/vendor/reformer-builder-stack-reformer/node-token-VfZdCqcs.js +1 -0
- package/dist/assets/vendor/reformer-builder-stack-reformer/paths-DeGLVPUt.js +1 -0
- package/dist/assets/{js/rules-CM1OzesO.js → vendor/reformer-builder-stack-reformer/rules-CQSVDlmo.js} +1 -1
- package/dist/assets/vendor/reformer-builder-stack-reformer/selectors-CjNSFsK9.js +1 -0
- package/dist/assets/vendor/reformer-builder-toolkit/marker-DiOaKX-e.js +4 -0
- package/dist/assets/vendor/reformer-cdk/define-steps-CyGUrx9p-vcI1WbRz.js +1 -0
- package/dist/assets/vendor/reformer-cdk/file-upload-D8FOieMN.js +1 -0
- package/dist/assets/vendor/reformer-cdk/form-array-DlFEb40E.js +1 -0
- package/dist/assets/vendor/reformer-cdk/form-wizard-DDLs_-Ya.js +1 -0
- package/dist/assets/vendor/reformer-cdk/index-CeCSv2Go.js +1 -0
- package/dist/assets/vendor/reformer-cdk/{list-BrqYwhrQ.js → list-DkqJWU70.js} +1 -1
- package/dist/assets/vendor/reformer-form-registry/{index-s1IAa6Lm.js → index-DflpiFcm.js} +1 -1
- package/dist/assets/vendor/reformer-form-registry/loader-BK2c_fCA-BtIEWzon.js +2 -0
- package/dist/assets/vendor/reformer-form-registry/react-BiEQRau3.js +1 -0
- package/dist/assets/vendor/reformer-renderer-json/{validate-C5Gll2Yt.js → validate-DXzHWMfT.js} +1 -1
- package/dist/assets/vendor/reformer-ui-kit/alert-base-WOl_V-qI-2ZIfaT1o.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/calendar-Bm2DDJDU.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/calendar-base.props-CqesU7CZ-tpDaVQbq.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/combobox-Dm4bFCVg.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/combobox-tree.props-BEQhnapq-DQmsBcYk.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/component-catalog-BEv0Zf-R.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/date-picker-CkVXt6Uh.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/date-picker-base.props-WBloFrDq-QhVYMCMG.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/input-otp-base.props-D1xRJiuO-DBKxHsz1.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/meta-YyKXxsBK.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/sidebar-CMzt3bAb.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/skeleton-base-C-lIzi0D-BjmjAmE9.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/toggle-group-multi.props-7kNpujN6-jLENMOcN.js +1 -0
- package/dist/assets/vendor/reformer-ui-kit/tree-node-schema-xHyN0QCr-CLbM_Aw_.js +1 -0
- package/dist/assets/vendor/render-DutGx1TC.js +46 -0
- package/dist/assets/vendor/sheet-base-Bdh947IC-CH2UsjIt.js +1 -0
- package/dist/assets/vendor/typescript/{typescript-Dp5hP5cS.js → typescript-BejA4q8A.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +6 -2
- package/runtime-config.schema.json +23 -1
- package/dist/assets/css/index-DgRudQqc.css +0 -1
- package/dist/assets/i18n/en-DHElWsPO.js +0 -1
- package/dist/assets/i18n/ru-DXsuKRv9.js +0 -1
- package/dist/assets/js/index-BSeq6-8S.js +0 -67
- package/dist/assets/js/index-CQvmAVe0.js +0 -115
- package/dist/assets/js/selectors-BiPlGN2c.js +0 -1
- package/dist/assets/monaco/html-R9lQ-L9C.js +0 -1
- package/dist/assets/monaco/javascript-COUjr2au.js +0 -1
- package/dist/assets/monaco/typescript-CVSiBX9O.js +0 -1
- package/dist/assets/monaco/xml-ee1lph4p.js +0 -1
- package/dist/assets/monaco/yaml-DXPc9WLc.js +0 -1
- package/dist/assets/plugins/ai-knowledge-docs-DCjqodcj.js +0 -1
- package/dist/assets/plugins/ai-knowledge-index-bUfNPqlZ.js +0 -1
- package/dist/assets/plugins/codegen-B0riFOHC.js +0 -416
- package/dist/assets/plugins/editor-markdown-oiBrRpM4.js +0 -2
- package/dist/assets/plugins/editor-schema-CVPAk-MV.js +0 -4
- package/dist/assets/plugins/plugin-manager-BmjjSqYy.js +0 -1
- package/dist/assets/plugins/templates-DNeIl0cD.js +0 -2
- package/dist/assets/vendor/collapsible-base-DZxAKbAF-h07cIL_F.js +0 -1
- package/dist/assets/vendor/index-jGqhTST4.js +0 -6
- package/dist/assets/vendor/lucide-react/eye-COs0olKf.js +0 -1
- package/dist/assets/vendor/lucide-react/file-code-corner-BMVX-Qf1.js +0 -1
- package/dist/assets/vendor/lucide-react/rotate-ccw-D0mVnqJN.js +0 -1
- package/dist/assets/vendor/lucide-react/wrench-BX6KiYsu.js +0 -1
- package/dist/assets/vendor/message-base-B5jT1FuY-GU8TkaN4.js +0 -1
- package/dist/assets/vendor/reformer-cdk/async-boundary-DPu-1Ifi.js +0 -1
- package/dist/assets/vendor/reformer-cdk/define-steps-CyGUrx9p-B_03D9I7.js +0 -1
- package/dist/assets/vendor/reformer-cdk/file-upload-C_DEa-OT.js +0 -1
- package/dist/assets/vendor/reformer-cdk/form-array-DRkRfAUh.js +0 -1
- package/dist/assets/vendor/reformer-cdk/form-wizard-DFqFjH7E.js +0 -1
- package/dist/assets/vendor/reformer-cdk/index-BXFomK5m.js +0 -1
- package/dist/assets/vendor/reformer-form-registry/loader-BK2c_fCA-D59m3JOQ.js +0 -2
- package/dist/assets/vendor/reformer-form-registry/react-B8lbN6s4.js +0 -1
- package/dist/assets/vendor/reformer-ui-kit/alert-base-WOl_V-qI-CYoSap05.js +0 -1
- package/dist/assets/vendor/reformer-ui-kit/component-catalog-BKjWf5Yx.js +0 -1
- /package/dist/assets/{js → vendor/reformer-builder-toolkit}/naming-9aaM0Wbc.js +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import{s as P,c as V,m as I,f as R,L as T}from"./reformer-builder-stack-reformer/paths-DeGLVPUt.js";import{e as q,v as _,h as W,a as M}from"./reformer-builder-stack-reformer/rules-CQSVDlmo.js";import{b6 as d,b4 as J,b9 as k,b7 as z,ak as $,b8 as Z,a7 as K,b5 as U,cs as L,ct as D}from"../js/index-C4LjLCAZ.js";import{k as y}from"./reformer-builder-toolkit/naming-9aaM0Wbc.js";function N(e,t){const r=JSON.stringify(e,null,2)??"undefined",o=" ".repeat(t);return r.split(`
|
|
2
|
+
`).map((s,a)=>a===0?s:`${o}${s}`).join(`
|
|
3
|
+
`)}function Ve(e,t={}){const r=P(e),o={model:{...r.model,...t.model},dataSources:{...r.dataSources,...t.dataSources}},s=V(e),a=[...s.optionLike].sort().map(c=>{const m=o.dataSources[c]??I(c);return` ${c}: ${N(m,4)},`}),i=[...s.scalarLike].sort().map(c=>` ${c}: ${JSON.stringify(o.dataSources[c]??"")},`),l=[...s.functionLike].sort().map(c=>` ${c}: (_item: unknown, index = 0) => \`#\${index + 1}\`,`),n=[...a,...i,...l].join(`
|
|
4
|
+
`),u=n===""?" // dataSources: в схеме нет ни одного $dataSource.":` dataSources: {
|
|
5
|
+
${n}
|
|
6
|
+
},`;return`/**
|
|
7
|
+
* Фикстура формы: чем наполнить её в предпросмотре.
|
|
8
|
+
*
|
|
9
|
+
* Слои независимы — заполняйте только нужные:
|
|
10
|
+
* model начальные значения (СТАРШЕ model.ts: фикстура пишется ради проверки)
|
|
11
|
+
* dataSources значения $dataSource
|
|
12
|
+
* modules подстановка импортов формы (./api, @/shared/...) — форма не пойдёт в сеть
|
|
13
|
+
* http перехват запросов, если форма всё же зовёт fetch
|
|
14
|
+
* clock фиксированные Date.now() и Math.random()
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export const fixture = {
|
|
18
|
+
model: ${N(o.model,2)},
|
|
19
|
+
|
|
20
|
+
${u}
|
|
21
|
+
|
|
22
|
+
// modules: {
|
|
23
|
+
// './api': { submitForm: async () => ({ success: true, data: { id: 'X1' } }) },
|
|
24
|
+
// },
|
|
25
|
+
|
|
26
|
+
// http: [{ method: 'GET', url: /\\/api\\//, respond: { json: [] } }],
|
|
27
|
+
|
|
28
|
+
// clock: { now: '2026-01-01T00:00:00Z', random: 0.42 },
|
|
29
|
+
};
|
|
30
|
+
`}function H(e,t){const r=e.componentProps??{};for(const o of T){const s=$(r[o]);if(s?.op==="dataSource"){const a=t.dataSources[s.arg];if(Array.isArray(a)&&a.length>0)return a.map(i=>String(i.value??""))}}return Array.isArray(r.options)&&r.options.length>0?r.options.map(o=>String(o.value??"")):null}function A(e,t,r=!1){const o=H(e,t);return o===null||o.length===0?null:[...new Set(r?["",...o]:o)].map(a=>`'${a.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`).join(" | ")}function X(e,t){const r=R(e);if(r==="select")return A(e,t,!0)??"string";if(r==="multi"){const o=A(e,t);return o===null?"string[] | null":`Array<${o}> | null`}return r==="file"?"unknown[] | null":r==="boolean"?"boolean":r==="number"?"number":"string"}function j(e,t,r){let o=e;for(let s=0;s<t.length-1;s+=1){const a=t[s],i=o.fields[a];(i===void 0||i.t!=="obj")&&(o.fields[a]={t:"obj",fields:{}}),o=o.fields[a]}o.fields[t[t.length-1]]=r}function v(e,t,r,o,s){const a={t:"obj",fields:{}},i=l=>{if(z(l)){const n=$(l.array);if(n?.op==="model"){const u=l.item?.$template,c=d(u)?v(u,t,!1,o,s):{t:"obj",fields:{}};j(a,n.arg.split("."),{t:"arr",elem:c}),r&&s.push(n.arg)}return}if(Z(l)){const n=$(l.value);n?.op==="model"&&(j(a,n.arg.split("."),{t:"leaf",ts:X(l,t)}),r&&l.componentProps?.required===!0&&o.push(n.arg));return}if(k(l)){l.children?.forEach(u=>{d(u)&&i(u)});const n=l.componentProps?.steps;Array.isArray(n)&&n.forEach(u=>{d(u)&&i(u)})}};return i(e),a}function C(e){if(!k(e))return[];const t=e.componentProps?.steps;if(Array.isArray(t))return t.filter(d);for(const r of e.children??[]){if(!d(r))continue;const o=C(r);if(o.length>0)return o}return[]}function G(e,t){const r=[],o=[],s=d(e.root)?v(e.root,t,!0,r,o):{t:"obj",fields:{}},a=d(e.root)?C(e.root).map(i=>{const l=[];v(i,t,!0,l,[]);const n=i.selector;return{selector:typeof n=="string"?n:null,required:l}}):[];return{root:s,components:J(e).components,ds:V(e),requiredPaths:r,arrayPaths:o,steps:a}}function Q(e){return y(e).split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Y(e){const t=y(e).replace(/-/g," ").trim();return t?t.charAt(0).toUpperCase()+t.slice(1):"Форма"}function x(e){const t=y(e)||"form",r=Q(e)||"Form",o=r.endsWith("Form")?r:`${r}Form`;return{dir:t,TypeName:o,pageComponent:`${r.endsWith("Form")?r.slice(0,-4):r}Page`,routePath:`/examples/${t}`,exampleId:t,title:Y(e),modelFactory:`create${o}Model`,entryConst:`${o.charAt(0).toLowerCase()}${o.slice(1)}Entry`}}function ee(e){const t=structuredClone(e),r=new Set(K(t)),o=u=>{const c=u||"node";let m=c,p=2;for(;r.has(m);)m=`${c}-${p}`,p+=1;return r.add(m),m},s=[],a=[];let i="",l="onClick";U(t,u=>{const c=u,m=$(c.component);if(k(u)){const f=c.componentProps?.title;(m?.op==="component"&&m.arg==="Section"||typeof f=="string")&&((c.selector===void 0||c.selector==="")&&(c.selector=o(`${y(String(f??m?.arg??"section"))}-section`)),s.push({selector:c.selector,label:String(f??c.selector)}))}if(z(u)){const f=$(c.array),g=f?.op==="model"?f.arg:"items";(c.selector===void 0||c.selector==="")&&(c.selector=o(y(g))),a.push({selector:c.selector,path:g})}const p=m?.op==="component"&&L(m.arg);m?.op==="component"&&(m.arg==="Button"||p)&&((c.selector===void 0||c.selector==="")&&(c.selector=o(p?"wizard":"submit")),i===""&&(i=c.selector,l=p?"onSubmit":"onClick"))});let n=!1;if(i===""){const u=t.root;Array.isArray(u.children)?(i=o("submit"),u.children.push({component:"$component(Button)",selector:i,componentProps:{type:"submit"},children:["Отправить"]}),n=!0):d(t.root)&&((u.selector===void 0||u.selector==="")&&(u.selector=o("root")),i=u.selector)}return{schema:t,info:{sections:s,arrays:a,submitSelector:i,submitEvent:l,injectedSubmit:n}}}function We(e){const{schema:t,info:r}=ee(e.schema),o=e.mock??P(t);return{schema:t,names:x(e.formName),collected:G(t,o),selectors:r,mock:o,rules:e.rules??q(),kit:e.kit,files:[]}}function ze(e,t){return{...e,files:t}}function te(e,t){const{kit:r,catalog:o}=t;if(r.codegen.needsShim.has(e))return{name:e,symbol:null,placeholder:!1,shim:!0};const s=r.previewPolicy.get(e);if(s?.mode==="limited")return{name:e,symbol:null,placeholder:!0,reason:s.reason??"компонент требует обвязки",shim:!1};const a=r.unresolvedReason.get(e);if(a!==void 0)return{name:e,symbol:null,placeholder:!0,reason:a,shim:!1};const i=o.find(l=>l.name===e);return i===void 0?{name:e,symbol:null,placeholder:!0,reason:`нет в каталоге кита «${r.label}»`,shim:!1}:{name:e,symbol:D(i),placeholder:!1,shim:!1}}const S="Step";function w(e){const t=e.kit.kit.adapters.wizard;if(t==null)return null;const r=e.kit.kit.codegen.needsShim,o=e.collected.components.filter(a=>L(a)&&r.has(a));if(o.length===0)return null;const s=e.kit.kit.codegen.importSpecifier;return{hostNames:o,hasStep:e.collected.components.includes(S),stepName:S,symbol:t.symbol,importFrom:t.subpath===void 0?s:`${s}/${t.subpath}`}}function oe(e){const t=e.trim();return/[()]/.test(t)?t:`${t}()`}function re(e){const t=new Set;for(const r of e)for(const o of r.rules){const s=o.match(/^([A-Za-z_$][\w$]*)/)?.[1];s&&t.add(s)}return[...t].sort()}function ne(e){const t=re(e.validation),r=e.validation.some(l=>l.async),o=e.validation.some(l=>l.when),s=e.validation.some(l=>l.each),a=["validate","defineValidationSchema"];r&&a.push("validateAsync"),o&&a.push("validateWhen"),s&&a.push("each");const i=[];i.push("/**"),i.push(` * Валидация формы «${e.formName}» — правила над МОДЕЛЬЮ, не в layout-схеме.`),i.push(" * Запуск: validateModel(model, formValidation)."),i.push(" */"),i.push(`import { ${a.join(", ")} } from '@reformer/core/validation';`),t.length>0&&i.push(`import { ${t.join(", ")} } from '@reformer/core/validators';`),i.push(`import type { ${e.interfaceName} } from './model';`),i.push(""),i.push(`export const formValidation = defineValidationSchema<${e.interfaceName}>(({ model }) => {`),e.validation.length===0&&i.push(" // Правил в intent не было — добавьте их здесь.");for(const l of e.validation){const n=[];l.rules.length>0&&n.push(`validate(model.$.${l.target}, [${l.rules.map(oe).join(", ")}]);`),l.async&&n.push(`validateAsync(model.$.${l.target}, [${l.async}]);`);let u=n.map(c=>` ${c}`).join(`
|
|
31
|
+
`);l.when&&(u=` validateWhen(() => ${l.when}, () => {
|
|
32
|
+
${n.map(c=>` ${c}`).join(`
|
|
33
|
+
`)}
|
|
34
|
+
});`),l.each&&(u=` each(model.$.${l.each}, (item) => {
|
|
35
|
+
${n.map(c=>` ${c.replace(`model.$.${l.target}`,`item.$.${l.target}`)}`).join(`
|
|
36
|
+
`)}
|
|
37
|
+
});`),i.push(u)}return i.push("});"),i.join(`
|
|
38
|
+
`)+`
|
|
39
|
+
`}function se(e){const t=new Set,r=[],o=[];for(const s of e){const a=(s.split(".").pop()??s).replace(/[^A-Za-z0-9_$]/g,"")||"value";let i=a;for(let l=2;t.has(i);l++)i=`${a}${l}`;t.add(i),r.push(i),i!==s&&o.push(`${s} → ${i}`)}return{params:r,renamed:o}}function ie(e){const t=`model.$.${e.target}`,r=e.sources.map(s=>`model.$.${s}`).join(", "),o=e.options?`, ${JSON.stringify(e.options)}`:"";switch(e.kind){case"compute":return` compute(${t}, () => ${e.expr??"undefined"});`;case"computeFrom":{const{params:s,renamed:a}=se(e.sources);return`${a.length>0?` // параметры названы по последнему сегменту: ${a.join(", ")}
|
|
40
|
+
`:""} computeFrom([${r}], ${t}, (${s.join(", ")}) => ${e.expr??"undefined"});`}case"copyFrom":return` copyFrom(model.$.${e.sources[0]??"source"}, ${t}${o});`;case"syncFields":return` syncFields(${t}, model.$.${e.sources[0]??"other"}${o});`;case"onChange":return` onChange(${t}, (value) => { ${e.expr??"/* эффект */"} }${o});`;case"enableWhen":case"disableWhen":return` ${e.kind}(${t}, () => ${e.expr??"true"}${o});`;case"resetWhen":return` resetWhen(${t}, () => ${e.expr??"false"}${o});`;case"transformValue":return` transformValue(${t}, (value) => ${e.expr??"value"});`;case"revalidateWhen":return` revalidateWhen([${r}], () => { ${e.expr??"/* перепроверка */"} });`;default:return` // неизвестный вид поведения: ${String(e.kind)}`}}function ae(e){const t=[...new Set(e.behavior.map(o=>o.kind))].sort(),r=[];r.push("/**"),r.push(` * Поведение формы «${e.formName}» — реактивные связи над моделью.`),r.push(" */"),r.push(`import { defineFormBehavior${t.length?`, ${t.join(", ")}`:""} } from '@reformer/core/behaviors';`),r.push(`import type { ${e.interfaceName} } from './model';`),r.push(""),r.push(`export const formBehavior = defineFormBehavior<${e.interfaceName}>(({ model }) => {`),e.behavior.length===0&&r.push(" // Поведения в intent не было — добавьте его здесь.");for(const o of e.behavior)r.push(ie(o));return r.push("});"),r.join(`
|
|
41
|
+
`)+`
|
|
42
|
+
`}function B(e){return String(e).replace(/[^\p{L}\p{N}]+/gu," ").trim().split(/\s+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("").replace(/[^A-Za-z0-9]/g,"")}function le(e){const t=B(e);return t.length>=2?`${t}Shape`:"FormShape"}function h(e){const t=typeof e?.name=="string"?e.name.trim():"";return t||(typeof e?.modelPath=="string"?e.modelPath.trim():"")||null}function ce(e){const t=[...e.warnings??[]],r=e.formName?.trim()||"Form",o=[],s=(n,u)=>n.filter(c=>c&&h(c)!==null?!0:(o.push(u),!1)),a=s(e.fields??[],"поле").map(n=>{const u=h(n);return{...n,name:u,modelPath:n.modelPath??u,selector:n.selector??u}}),i=s(e.arrays??[],"массив").map(n=>{const u=h(n),c=typeof n.itemInterfaceName=="string"?n.itemInterfaceName.trim():"";return c||t.push(`Массив \`${u}\` без itemInterfaceName — интерфейс элемента назван по умолчанию.`),{...n,name:u,modelPath:n.modelPath??u,itemInterfaceName:c||`${B(u.split(".").pop()??u)||"Array"}Item`,itemFields:s(n.itemFields??[],`поле массива \`${u}\``).map(m=>{const p=h(m);return{...m,name:p,modelPath:m.modelPath??p,selector:m.selector??p}}),initialValue:Array.isArray(n.initialValue)?n.initialValue:[]}});for(const n of new Set(o)){const u=o.filter(c=>c===n).length;t.push(`Без имени, поэтому выброшено (${n}): ${u}. У записи обязателен \`name\`.`)}for(const n of i){const u=(e.arrays??[]).find(c=>c&&h(c)===n.name);Array.isArray(u?.initialValue)||t.push(`Массив \`${n.name}\` без initialValue — подставлен пустой массив.`)}const l=[...new Map((e.dataSources??[]).filter(n=>n&&typeof n.name=="string"&&n.name.trim()).map(n=>[n.name,n])).values()];return a.length===0&&i.length===0&&t.push("В intent нет ни одного поля — бандл будет пустым каркасом."),{formName:r,interfaceName:e.interfaceName?.trim()||le(r),target:e.target??"core",layout:e.layout??"minimalist",layoutRoot:e.layoutRoot??{kind:"container",component:"Box",children:[...a.map(n=>({kind:"field",ref:n.name})),...i.map(n=>({kind:"array",ref:n.name}))]},fields:a,arrays:i,validation:e.validation??[],behavior:e.behavior??[],visibility:e.visibility??[],dataSources:l,wizard:e.wizard,warnings:t}}const ue=["compute","computeFrom","copyFrom","syncFields","onChange","enableWhen","disableWhen","resetWhen","transformValue","revalidateWhen"];new Map(ue.map(e=>[e.toLowerCase(),e]));function O(e,t){return ce({formName:t.title,interfaceName:t.TypeName,validation:[...e.validation],behavior:[...e.behavior],visibility:_(e)})}function E(e,t){return e.replace(new RegExp(`import type \\{ ${t} \\} from './model';`),`import type { ${t} } from './types';`)}function me(e,t){return E(ne(O(e,t)),t.TypeName)}function pe(e,t){return E(ae(O(e,t)),t.TypeName)}function de(e){const{collected:t,kit:r}=e,o=r.kit.infra.fieldWrapper,s=w(e),a=new Set(s===null?[]:[...s.hostNames,...s.hasStep?[S]:[]]),i=t.components.filter(n=>!a.has(n)).map(n=>te(n,r)).map(n=>n.shim?{name:n.name,symbol:null,placeholder:!0,reason:`кит «${r.kit.label}» не поставляет адаптер для этого компонента`}:{name:n.name,symbol:n.symbol,placeholder:n.placeholder,...n.reason===void 0?{}:{reason:n.reason}}),l=new Set([o]);for(const n of i)n.symbol!==null&&l.add(n.symbol);return{fieldWrapper:o,kitSymbols:[...l].sort(),components:i,dataSourceNames:[...[...t.ds.optionLike].sort(),...[...t.ds.scalarLike].sort(),...[...t.ds.functionLike].sort()],hasPlaceholder:i.some(n=>n.placeholder)}}function F(e){return/^[A-Za-z_$][\w$]*$/.test(e)?e:JSON.stringify(e)}function fe(e){return`{ ${Object.entries(e).map(([r,o])=>typeof o=="string"&&o.startsWith("$expr(")&&o.endsWith(")")?`${F(r)}: ${o.slice(6,-1)}`:`${F(r)}: ${JSON.stringify(o)}`).join(", ")} }`}function he(e){const t=`schema.node('${e.selector}')`;switch(e.kind){case"hideWhen":return[`hideWhen(${t}, () => ${e.condition});`];case"onEvent":{const r=e.async===!0?"async (...args: unknown[])":"(...args: unknown[])";return[`onComponentEvent(${t}, '${e.event}', ${r} => {`," void args;",...e.body.split(`
|
|
43
|
+
`).map(o=>` ${o}`),"});"]}case"patchProps":return[`${t}.patchProps(${fe(e.props)});`]}}function $e(e){const t=e.rules.render,r=new Set(t.filter(s=>s.kind==="hideWhen").map(s=>s.selector)),o=e.selectors.submitEvent==="onSubmit";return{isWizard:o,target:o?"wizard":"submit",imports:["hideWhen","onComponentEvent",...o?["onInit"]:[]].sort(),voidHideWhen:r.size===0,rules:t.map(s=>({lines:he(s)})),scaffold:e.selectors.sections.filter(s=>!r.has(s.selector)).map(s=>({selector:s.selector,label:s.label}))}}function ye(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?e:JSON.stringify(e)}function b(e,t){if(e.t==="leaf")return e.ts;if(e.t==="arr")return`Array<${b(e.elem,t)}>`;const r=Object.keys(e.fields);if(r.length===0)return"Record<string, unknown>";const o=" ".repeat(t+1),s=" ".repeat(t);return`{
|
|
44
|
+
${r.map(i=>`${o}${ye(i)}: ${b(e.fields[i],t+1)};`).join(`
|
|
45
|
+
`)}
|
|
46
|
+
${s}}`}function ge(e){const t=e.collected.root;return{text:b(t,0)}}const ve=(e,t)=>{const r=" ".repeat(t);return e.map(o=>o===""?"":`${r}${o}`).join(`
|
|
47
|
+
`)},Se=e=>e.filter(t=>t!=="").join(`
|
|
48
|
+
|
|
49
|
+
`),be=(e,t=0)=>{const r=JSON.stringify(e,null,2);if(t===0)return r;const o=" ".repeat(t);return r.split(`
|
|
50
|
+
`).map((s,a)=>a===0||s===""?s:`${o}${s}`).join(`
|
|
51
|
+
`)};function ke(e){return{get validationCode(){return W(e.rules)?me(e.rules,e.names):null},get behaviorCode(){return M(e.rules)?pe(e.rules,e.names):null}}}function we(e){const{ds:t}=e.collected,r=e.mock.dataSources;return{options:[...t.optionLike].sort().map(o=>{const s=r[o];return{name:o,value:Array.isArray(s)?s:[]}}),scalars:[...t.scalarLike].sort().map(o=>({name:o,literal:JSON.stringify(r[o]??"")})),labels:[...t.functionLike].sort()}}function Ne(e){const t=e.collected.steps;if(t.length===0||w(e)===null||W(e.rules))return null;const r=new Set(t.flatMap(o=>o.required));return{steps:t.map((o,s)=>({name:`step${s+1}`,selector:o.selector,required:[...new Set(o.required)]})),rest:[...new Set(e.collected.requiredPaths)].filter(o=>!r.has(o))}}function Le(e){return{names:e.names,mock:e.mock,dataSources:we(e),kit:{importSpecifier:e.kit.kit.codegen.importSpecifier,label:e.kit.kit.label},selectors:e.selectors,types:ge(e),rules:ke(e),required:[...new Set(e.collected.requiredPaths)],wizard:w(e),stepValidation:Ne(e),registry:de(e),renderBehavior:$e(e),files:e.files,indent:ve,json:be,blocks:Se}}function Ce(e,t){return{...e,files:t}}function Be(e,t){return{...e,local:t}}export{Ce as a,Le as b,Be as c,w as d,Ve as e,We as p,ze as w};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{Y as n,ao as Te,Z as S,af as U,aq as Oe,bj as Re}from"../js/index-C4LjLCAZ.js";import{e as rt}from"./reformer-ui-kit/input-otp-base.props-D1xRJiuO-DBKxHsz1.js";import{M as De}from"./lucide-react/minus-zJRYKuAo.js";var Ae=Object.defineProperty,Be=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,ve=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,fe=(e,r,l)=>r in e?Ae(e,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[r]=l,We=(e,r)=>{for(var l in r||(r={}))ve.call(r,l)&&fe(e,l,r[l]);if(Y)for(var l of Y(r))he.call(r,l)&&fe(e,l,r[l]);return e},Fe=(e,r)=>Be(e,Ie(r)),Ne=(e,r)=>{var l={};for(var i in e)ve.call(e,i)&&r.indexOf(i)<0&&(l[i]=e[i]);if(e!=null&&Y)for(var i of Y(e))r.indexOf(i)<0&&he.call(e,i)&&(l[i]=e[i]);return l};function _e(e){let r=setTimeout(e,0),l=setTimeout(e,10),i=setTimeout(e,50);return[r,l,i]}function He(e){let r=n.useRef();return n.useEffect(()=>{r.current=e}),r.current}var Le=18,ge=40,$e=`${ge}px`,Ge=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function ze({containerRef:e,inputRef:r,pushPasswordManagerStrategy:l,isFocused:i}){let[g,s]=n.useState(!1),[C,w]=n.useState(!1),[B,_]=n.useState(!1),H=n.useMemo(()=>l==="none"?!1:(l==="increase-width"||l==="experimental-no-flickering")&&g&&C,[g,C,l]),I=n.useCallback(()=>{let f=e.current,M=r.current;if(!f||!M||B||l==="none")return;let b=f,P=b.getBoundingClientRect().left+b.offsetWidth,W=b.getBoundingClientRect().top+b.offsetHeight/2,u=P-Le,L=W;document.querySelectorAll(Ge).length===0&&document.elementFromPoint(u,L)===f||(s(!0),_(!0))},[e,r,B,l]);return n.useEffect(()=>{let f=e.current;if(!f||l==="none")return;function M(){let P=window.innerWidth-f.getBoundingClientRect().right;w(P>=ge)}M();let b=setInterval(M,1e3);return()=>{clearInterval(b)}},[e,l]),n.useEffect(()=>{let f=i||document.activeElement===r.current;if(l==="none"||!f)return;let M=setTimeout(I,0),b=setTimeout(I,2e3),P=setTimeout(I,5e3),W=setTimeout(()=>{_(!0)},6e3);return()=>{clearTimeout(M),clearTimeout(b),clearTimeout(P),clearTimeout(W)}},[r,i,l,I]),{hasPWMBadge:g,willPushPWMBadge:H,PWM_BADGE_SPACE_WIDTH:$e}}var be=n.createContext({}),xe=n.forwardRef((e,r)=>{var l=e,{value:i,onChange:g,maxLength:s,textAlign:C="left",pattern:w,placeholder:B,inputMode:_="numeric",onComplete:H,pushPasswordManagerStrategy:I="increase-width",pasteTransformer:f,containerClassName:M,noScriptCSSFallback:b=Ve,render:P,children:W}=l,u=Ne(l,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),L,ne,re,ae,le;let[we,Ee]=n.useState(typeof u.defaultValue=="string"?u.defaultValue:""),c=i??we,T=He(c),$=n.useCallback(t=>{g?.(t),Ee(t)},[g]),E=n.useMemo(()=>w?typeof w=="string"?new RegExp(w):w:null,[w]),d=n.useRef(null),K=n.useRef(null),Q=n.useRef({value:c,onChange:$,isIOS:typeof window<"u"&&((ne=(L=window?.CSS)==null?void 0:L.supports)==null?void 0:ne.call(L,"-webkit-touch-callout","none"))}),Z=n.useRef({prev:[(re=d.current)==null?void 0:re.selectionStart,(ae=d.current)==null?void 0:ae.selectionEnd,(le=d.current)==null?void 0:le.selectionDirection]});n.useImperativeHandle(r,()=>d.current,[]),n.useEffect(()=>{let t=d.current,a=K.current;if(!t||!a)return;Q.current.value!==t.value&&Q.current.onChange(t.value),Z.current.prev=[t.selectionStart,t.selectionEnd,t.selectionDirection];function p(){if(document.activeElement!==t){z(null),V(null);return}let o=t.selectionStart,m=t.selectionEnd,J=t.selectionDirection,x=t.maxLength,R=t.value,y=Z.current.prev,j=-1,k=-1,D;if(R.length!==0&&o!==null&&m!==null){let Me=o===m,je=o===R.length&&R.length<x;if(Me&&!je){let A=o;if(A===0)j=0,k=1,D="forward";else if(A===x)j=A-1,k=A,D="backward";else if(x>1&&R.length>1){let te=0;if(y[0]!==null&&y[1]!==null){D=A<y[1]?"backward":"forward";let ke=y[0]===y[1]&&y[0]<x;D==="backward"&&!ke&&(te=-1)}j=te+A,k=te+A+1}}j!==-1&&k!==-1&&j!==k&&d.current.setSelectionRange(j,k,D)}let pe=j!==-1?j:o,me=k!==-1?k:m,Ce=D??J;z(pe),V(me),Z.current.prev=[pe,me,Ce]}if(document.addEventListener("selectionchange",p,{capture:!0}),p(),document.activeElement===t&&X(!0),!document.getElementById("input-otp-style")){let o=document.createElement("style");if(o.id="input-otp-style",document.head.appendChild(o),o.sheet){let m="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";q(o.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),q(o.sheet,`[data-input-otp]:autofill { ${m} }`),q(o.sheet,`[data-input-otp]:-webkit-autofill { ${m} }`),q(o.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),q(o.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let v=()=>{a&&a.style.setProperty("--root-height",`${t.clientHeight}px`)};v();let h=new ResizeObserver(v);return h.observe(t),()=>{document.removeEventListener("selectionchange",p,{capture:!0}),h.disconnect()}},[]);let[oe,ie]=n.useState(!1),[G,X]=n.useState(!1),[O,z]=n.useState(null),[F,V]=n.useState(null);n.useEffect(()=>{_e(()=>{var t,a,p,v;(t=d.current)==null||t.dispatchEvent(new Event("input"));let h=(a=d.current)==null?void 0:a.selectionStart,o=(p=d.current)==null?void 0:p.selectionEnd,m=(v=d.current)==null?void 0:v.selectionDirection;h!==null&&o!==null&&(z(h),V(o),Z.current.prev=[h,o,m])})},[c,G]),n.useEffect(()=>{T!==void 0&&c!==T&&T.length<s&&c.length===s&&H?.(c)},[s,H,T,c]);let N=ze({containerRef:K,inputRef:d,pushPasswordManagerStrategy:I,isFocused:G}),ue=n.useCallback(t=>{let a=t.currentTarget.value.slice(0,s);if(a.length>0&&E&&!E.test(a)){t.preventDefault();return}typeof T=="string"&&a.length<T.length&&document.dispatchEvent(new Event("selectionchange")),$(a)},[s,$,T,E]),se=n.useCallback(()=>{var t;if(d.current){let a=Math.min(d.current.value.length,s-1),p=d.current.value.length;(t=d.current)==null||t.setSelectionRange(a,p),z(a),V(p)}X(!0)},[s]),ce=n.useCallback(t=>{var a,p;let v=d.current;if(!f&&(!Q.current.isIOS||!t.clipboardData||!v))return;let h=t.clipboardData.getData("text/plain"),o=f?f(h):h;t.preventDefault();let m=(a=d.current)==null?void 0:a.selectionStart,J=(p=d.current)==null?void 0:p.selectionEnd,x=(m!==J?c.slice(0,m)+o+c.slice(J):c.slice(0,m)+o+c.slice(m)).slice(0,s);if(x.length>0&&E&&!E.test(x))return;v.value=x,$(x);let R=Math.min(x.length,s-1),y=x.length;v.setSelectionRange(R,y),z(R),V(y)},[s,$,E,c]),Se=n.useMemo(()=>({position:"relative",cursor:u.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[u.disabled]),de=n.useMemo(()=>({position:"absolute",inset:0,width:N.willPushPWMBadge?`calc(100% + ${N.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:N.willPushPWMBadge?`inset(0 ${N.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:C,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[N.PWM_BADGE_SPACE_WIDTH,N.willPushPWMBadge,C]),Pe=n.useMemo(()=>n.createElement("input",Fe(We({autoComplete:u.autoComplete||"one-time-code"},u),{"data-input-otp":!0,"data-input-otp-placeholder-shown":c.length===0||void 0,"data-input-otp-mss":O,"data-input-otp-mse":F,inputMode:_,pattern:E?.source,"aria-placeholder":B,style:de,maxLength:s,value:c,ref:d,onPaste:t=>{var a;ce(t),(a=u.onPaste)==null||a.call(u,t)},onChange:ue,onMouseOver:t=>{var a;ie(!0),(a=u.onMouseOver)==null||a.call(u,t)},onMouseLeave:t=>{var a;ie(!1),(a=u.onMouseLeave)==null||a.call(u,t)},onFocus:t=>{var a;se(),(a=u.onFocus)==null||a.call(u,t)},onBlur:t=>{var a;X(!1),(a=u.onBlur)==null||a.call(u,t)}})),[ue,se,ce,_,de,s,F,O,u,E?.source,c]),ee=n.useMemo(()=>({slots:Array.from({length:s}).map((t,a)=>{var p;let v=G&&O!==null&&F!==null&&(O===F&&a===O||a>=O&&a<F),h=c[a]!==void 0?c[a]:null,o=c[0]!==void 0?null:(p=B?.[a])!=null?p:null;return{char:h,placeholderChar:o,isActive:v,hasFakeCaret:v&&h===null}}),isFocused:G,isHovering:!u.disabled&&oe}),[G,oe,s,F,O,u.disabled,c]),ye=n.useMemo(()=>P?P(ee):n.createElement(be.Provider,{value:ee},W),[W,ee,P]);return n.createElement(n.Fragment,null,b!==null&&n.createElement("noscript",null,n.createElement("style",null,b)),n.createElement("div",{ref:K,"data-input-otp-container":!0,style:Se,className:M},ye,n.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Pe)))});xe.displayName="Input";function q(e,r){try{e.insertRule(r)}catch{console.error("input-otp could not insert CSS rule:",r)}}var Ve=`
|
|
2
|
+
[data-input-otp] {
|
|
3
|
+
--nojs-bg: white !important;
|
|
4
|
+
--nojs-fg: black !important;
|
|
5
|
+
|
|
6
|
+
background-color: var(--nojs-bg) !important;
|
|
7
|
+
color: var(--nojs-fg) !important;
|
|
8
|
+
caret-color: var(--nojs-fg) !important;
|
|
9
|
+
letter-spacing: .25em !important;
|
|
10
|
+
text-align: center !important;
|
|
11
|
+
border: 1px solid var(--nojs-fg) !important;
|
|
12
|
+
border-radius: 4px !important;
|
|
13
|
+
width: 100% !important;
|
|
14
|
+
}
|
|
15
|
+
@media (prefers-color-scheme: dark) {
|
|
16
|
+
[data-input-otp] {
|
|
17
|
+
--nojs-bg: black !important;
|
|
18
|
+
--nojs-fg: white !important;
|
|
19
|
+
}
|
|
20
|
+
}`;function qe({className:e,containerClassName:r,...l}){return S.jsx(xe,{"data-slot":"input-otp",containerClassName:U("flex items-center gap-2 has-disabled:opacity-50",r),className:U("disabled:cursor-not-allowed",e),...l})}function Ze({className:e,...r}){return S.jsx("div",{"data-slot":"input-otp-group",className:U("flex items-center",e),...r})}function Je({index:e,className:r,...l}){const i=n.useContext(be),{char:g,hasFakeCaret:s,isActive:C}=i?.slots[e]??{};return S.jsxs("div",{"data-slot":"input-otp-slot","data-active":C,className:U("relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-[3px] data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40",r),...l,children:[g,s&&S.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:S.jsx("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})}function Xe({...e}){return S.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...e,children:S.jsx(De,{})})}const Ue={valueProp:"value",changeProp:"onChange",fromEmit:e=>e||null,toValue:e=>e??""};function Ye(e){const{maxLength:r=6,children:l,...i}=e,g=l??S.jsx(Ze,{children:Array.from({length:r},(C,w)=>S.jsx(Je,{index:w},w))}),s={...i,maxLength:r,children:g};return S.jsx(qe,{...s})}const et=Te(Oe(Ye,Re),Ue);export{qe as InputOTP,et as InputOTPBaseField,et as InputOTPField,Ze as InputOTPGroup,Xe as InputOTPSeparator,Je as InputOTPSlot,rt as inputOtpBasePropsSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ae as e}from"../../js/index-C4LjLCAZ.js";const o=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],r=e("arrow-left",o);export{r as A};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ae as o}from"../../js/index-C4LjLCAZ.js";const r=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],a=o("arrow-right",r);export{a as A};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ae as e}from"../../js/index-C4LjLCAZ.js";const t=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],c=e("calendar",t);export{c as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ae as e}from"../../js/index-C4LjLCAZ.js";const c=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],n=e("code-xml",c);const o=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],d=e("columns-2",o);const t=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],r=e("eye",t);export{n as C,r as E,d as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ae as e}from"../../js/index-C4LjLCAZ.js";const o=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],t=e("file-code-corner",o);export{t as F};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ae as a}from"../../js/index-C4LjLCAZ.js";const e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],h=a("circle-x",e);const c=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],t=a("folder-tree",c);export{h as C,t as F};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ae as o}from"../../js/index-C4LjLCAZ.js";const e=[["path",{d:"M5 12h14",key:"1ays0h"}]],a=o("minus",e);export{a as M};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ae as e}from"../../js/index-C4LjLCAZ.js";const o=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],a=e("plus",o);export{a as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ae as e}from"../../js/index-C4LjLCAZ.js";const t=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],c=e("file-code",t);const a=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],y=e("layout-template",a);const o=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],d=e("rotate-ccw",o);export{c as F,y as L,d as R};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ae as a}from"../../js/index-C4LjLCAZ.js";const e=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],y=a("blocks",e);const t=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],p=a("braces",t);const h=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]],k=a("layout-panel-top",h);const o=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],r=a("list",o);const c=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],i=a("sliders-horizontal",c);const s=[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}]],M=a("square-mouse-pointer",s);const d=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],l=a("wrench",d);export{p as B,r as L,M as S,l as W,k as a,y as b,i as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ae as n,Z as s,af as t}from"../js/index-C4LjLCAZ.js";const o=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],u=n("message-square-plus",o);const d=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],f=n("send",d);const r=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],g=n("sparkles",r);const i=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],x=n("square",i);const m=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],p=n("undo-2",m);function h({className:a,...e}){return s.jsx("div",{"data-slot":"message-group",className:t("flex min-w-0 flex-col gap-2",a),...e})}function y({className:a,align:e="start",...l}){return s.jsx("div",{"data-slot":"message","data-align":e,className:t("group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",a),...l})}function w({className:a,...e}){return s.jsx("div",{"data-slot":"message-avatar",className:t("flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8",a),...e})}function k({className:a,...e}){return s.jsx("div",{"data-slot":"message-content",className:t("flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",a),...e})}function N({className:a,...e}){return s.jsx("div",{"data-slot":"message-header",className:t("flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",a),...e})}function v({className:a,...e}){return s.jsx("div",{"data-slot":"message-footer",className:t("flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",a),...e})}export{u as M,g as S,p as U,x as a,f as b,w as d,k as g,N as i,h as l,y as m,v as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Y as n,Z as y,af as te,bk as ze,aw as He}from"../js/index-C4LjLCAZ.js";function Le({defaultTagName:e,props:t,render:r,state:l={},stateAttributesMapping:o}){let s=ce(Ve(l,o),t);if(!r)return n.createElement(e,s);if(typeof r=="function")return r(s,l);if(!n.isValidElement(r))return null;let u=r.props,a={...ce(s,u),ref:re(s.ref,u.ref)};return n.cloneElement(r,a)}function ce(...e){let t={};for(let r of e){if(!r)continue;let l=r;for(let o of Object.keys(l)){let s=l[o];if(s===void 0)continue;let u=t[o];o==="className"?t[o]=[u,s].filter(Boolean).join(" "):o==="style"?t[o]={...u,...s}:o==="ref"?t[o]=re(u,s):qe(o)&&typeof u=="function"&&typeof s=="function"?t[o]=De(s,u):t[o]=s}}return t}function Ve(e,t){let r={};for(let l of Object.keys(e)){let o=e[l],s=t?.[l]?.(o);if(s){Object.assign(r,s);continue}if(l==="slot"){r["data-slot"]=o;continue}let u=`data-${String(l).replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`)}`;typeof o=="boolean"?r[u]=o?"":void 0:o!=null&&(r[u]=String(o))}return r}function De(e,t){return function(r){e(r),r.defaultPrevented||t(r)}}function qe(e){return/^on[A-Z]/.test(e)}function re(...e){let t=e.filter(Boolean);if(t.length!==0)return r=>{for(let l of t)typeof l=="function"?l(r):l&&(l.current=r)}}var Ge=8,$e=64,Ue=0,ae=.5,_e=180,We=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),Pe={start:!1,end:!1},Ye=[],ue={currentAnchorId:null,visibleMessageIds:Ye};function Ke({content:e,scrollEdgeThreshold:t,spacer:r,viewport:l}){if(!l||!e)return Pe;let o=fe({content:e,spacer:r,viewport:l});return{start:l.scrollTop>t,end:o-l.scrollTop-l.clientHeight>t}}function Ze({content:e,scrollMargin:t,scrollPreviousItemPeek:r,spacer:l,viewport:o,visibleMessageIds:s}){if(!e||!o)return ue;let u=o.getBoundingClientRect(),a=u.top+t+r,h=typeof IntersectionObserver>"u",w=[],v=null;for(let T of ee(e,l)){let m=T.dataset.messageId;if(!m)continue;let b=T.dataset.scrollAnchor==="true",C=b||h?T.getBoundingClientRect():null;(h&&C?C.bottom>a&&C.top<u.bottom:s.has(m))&&w.push(m),b&&C&&C.top<=a+ae&&(v=m)}return w.length===0&&v===null?ue:{currentAnchorId:v,visibleMessageIds:w}}function ee(e,t){return Array.from(e.children).filter(r=>r instanceof HTMLElement&&r!==t)}function Je(e,t){for(let r=t;r<e.length;r++){let l=e[r];if(l?.dataset.scrollAnchor==="true")return l}return null}function Qe(e,t){for(let r of e)if(r.dataset.scrollAnchor==="true"&&!t.has(r))return r;return null}function Xe(e,t){let r=0;for(let l=t;l<e.length;l++)if(e[l]?.dataset.scrollAnchor==="true"&&(r+=1,r>1))return!0;return!1}function et(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if(r?.dataset.scrollAnchor==="true")return r}return null}function tt({content:e,spacer:t,viewport:r}){let l=r.getBoundingClientRect();for(let o of ee(e,t)){if(!o.dataset.messageId)continue;let s=o.getBoundingClientRect();if(s.bottom>l.top&&s.top<l.bottom)return o}return null}function rt({align:e,element:t,scrollMargin:r,spacer:l,viewport:o}){let s=Ie(t,o),u=t.getBoundingClientRect().height,a=ot(l);if(e==="center"){let h=Math.max(0,o.clientHeight-a.start-a.end);return s-a.start-(h-u)/2-r}if(e==="end")return s-o.clientHeight+u+a.end+r;if(e==="nearest"){let h=s+u,w=o.scrollTop+a.start,v=o.scrollTop+o.clientHeight-a.end;return s>=w&&h<=v?o.scrollTop:s<w?s-a.start-r:h-o.clientHeight+a.end+r}return s-a.start-r}function Ie(e,t){let r=e.getBoundingClientRect(),l=t.getBoundingClientRect();return r.top-l.top+t.scrollTop}function se(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function nt({content:e,scrollTop:t,spacer:r,viewport:l}){let o=fe({content:e,spacer:r,viewport:l});return t+l.clientHeight-o}function fe({content:e,spacer:t,viewport:r}){let l=ee(e,t),o=Ae(e),s=r.getBoundingClientRect(),u=r.scrollTop,a=o.start+o.end;for(let h of l){let w=h.getBoundingClientRect();a=Math.max(a,w.bottom-s.top+u+o.end)}return a}function lt(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Ae(e){let t=window.getComputedStyle(e);return{end:ie(t.paddingBlockEnd||t.paddingBottom),start:ie(t.paddingBlockStart||t.paddingTop)}}function ot(e){let t=e?.parentElement;return t?Ae(t):{end:0,start:0}}function st(e){if(!e)return 0;let t=window.getComputedStyle(e),r=t.rowGap==="normal"?t.gap:t.rowGap;return ie(r)}function ie(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function at({refs:e,commitScrollState:t,scheduleStateCommit:r,scheduleVisibilitySync:l}){let{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:u,autoscrollingTimeoutRef:a,contentRef:h,defaultScrollPositionAppliedRef:w,itemCountRef:v,messageElementsRef:T,modeRef:m,pendingScrollToMessageRef:b,prependRestoreRef:C,scrollMarginRef:I,scrollPreviousItemPeekRef:d,spacerGapRef:j,spacerHeightRef:G,spacerRef:N,viewportRef:B}=e,V=n.useCallback(f=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null),u.current!==f&&(u.current=f,t()),f&&(a.current=window.setTimeout(()=>{a.current=null,u.current=!1,t()},_e))},[t]),S=n.useCallback(f=>{let g=N.current;if(!g)return;let R=Math.max(0,Math.ceil(f));G.current!==R&&(G.current=R,g.hidden=R===0,g.style.height=`${R}px`,g.style.marginTop=R>0?`${-j.current}px`:"")},[]),x=n.useCallback((f,{behavior:g="auto",autoscrolling:R=!1}={})=>{let M=B.current;if(!M)return;let k=Math.max(0,f);if(Math.abs(M.scrollTop-k)<=ae){M.scrollTop=k,t();return}R&&V(!0),M.scrollTo({top:k,behavior:g}),r()},[t,r,V]),D=n.useCallback(({behavior:f="auto"}={})=>B.current?(S(0),o.current=null,m.current="free-scrolling",x(0,{behavior:f}),l(),!0):!1,[l,x,S]),K=n.useCallback(({behavior:f="auto"}={})=>{let g=B.current;return g?(S(0),o.current=null,m.current=s.current?"following-bottom":"free-scrolling",x(lt(g),{autoscrolling:!0,behavior:f}),l(),!0):!1},[l,x,S]),A=n.useCallback((f,{align:g="start",behavior:R="auto",scrollMargin:M=I.current}={},{keepPreviousPeek:k=!1}={})=>{let q=h.current,$=B.current;if(!q||!$||!q.contains(f))return!1;let Z=rt({align:g,element:f,scrollMargin:k?M+d.current:M,spacer:N.current,viewport:$}),_=nt({content:q,scrollTop:Z,spacer:N.current,viewport:$});return S(_),C.current={element:f,viewportTop:se(f,$)},m.current=k?"anchored-to-message":"settling-jump",o.current=k?f:null,x(Z,{behavior:R}),l(),!0},[l,x,S]),z=n.useCallback(()=>{let f=o.current;return!f||!f.isConnected||m.current!=="anchored-to-message"?!1:A(f,{align:"start"},{keepPreviousPeek:!0})},[A]),H=n.useCallback((f,g)=>{let R=T.current.get(f);return R?(w.current=!0,A(R,g)?(b.current=null,!0):(b.current={messageId:f,options:g},!0)):v.current===0?(b.current={messageId:f,options:g},w.current=!0,!0):!1},[A]);return{flushPendingScrollToMessage:n.useCallback(()=>{let f=b.current;if(!f)return!1;let g=T.current.get(f.messageId);return!g||!A(g,f.options)?!1:(b.current=null,w.current=!0,!0)},[A]),reanchorToAnchoredMessage:z,scrollToElement:A,scrollToEnd:K,scrollToMessage:H,scrollToStart:D}}function je(e,t){let r=e,l=new Set;return{getSnapshot:()=>r,hasListeners:()=>l.size>0,setSnapshot:o=>{t(r,o)||(r=o,l.forEach(s=>s()))},subscribe:(o,s,u)=>{let a=l.size===0;return l.add(o),a&&s?.(),()=>{l.delete(o),l.size===0&&u?.()}}}}function ut(e,t){return je(e,t)}function ct(){return je(ue,ft)}function it(e,t){return e.start===t.start&&e.end===t.end}function ft(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((r,l)=>r===t.visibleMessageIds[l])}function dt({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:r,scrollPreviousItemPeek:l}){let o=n.useRef(e),s=n.useRef(!1),u=n.useRef(null),a=n.useRef(!1),h=n.useRef(t),w=n.useRef(0),v=n.useRef(null),T=n.useRef(0),m=n.useRef(e?"following-bottom":"free-scrolling"),b=n.useRef(new Map),C=n.useRef(null),I=n.useRef(null),d=n.useRef(null),j=n.useRef(l),G=n.useRef(!0),N=n.useRef(null),B=n.useRef(r),V=n.useRef(null),S=n.useRef(0),x=n.useRef(0),D=n.useRef(null),K=n.useRef(null),A=n.useRef(null),z=n.useRef(null),H=n.useRef(null),f=n.useRef(null),g=n.useRef(null),R=n.useRef(null),M=n.useRef(new Set),k=n.useRef(new WeakSet);return A.current===null&&(A.current=ut(Pe,it)),R.current===null&&(R.current=ct()),o.current=e,h.current=t,B.current=r,j.current=l,{autoScrollRef:o,autoscrollingRef:s,autoscrollingTimeoutRef:z,streamingTurnRef:d,contentRef:u,defaultScrollPositionAppliedRef:a,firstItemRef:v,itemCountRef:w,lastScrollTopRef:T,messageElementsRef:b,modeRef:m,pendingScrollFrameRef:V,pendingScrollToMessageRef:C,prependRestoreRef:I,preserveScrollOnPrependRef:G,rootRef:N,scrollEdgeThresholdRef:h,scrollMarginRef:B,scrollPreviousItemPeekRef:j,spacerGapRef:S,spacerHeightRef:x,spacerRef:D,stateFrameRef:K,stateStore:A.current,viewportRef:H,visibilityFrameRef:f,visibilityObserverRef:g,visibilityStore:R.current,visibleMessageIdsRef:M,handledScrollAnchorsRef:k}}function xe(e,t){return n.useCallback(r=>{e.current=r,r&&t()},[e,t])}function gt({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:r=Ge,scrollPreviousItemPeek:l=$e,scrollMargin:o=Ue}){let s=dt({autoScroll:e,scrollEdgeThreshold:r,scrollMargin:o,scrollPreviousItemPeek:l}),{streamingTurnRef:u,autoScrollRef:a,autoscrollingRef:h,autoscrollingTimeoutRef:w,contentRef:v,defaultScrollPositionAppliedRef:T,firstItemRef:m,itemCountRef:b,lastScrollTopRef:C,messageElementsRef:I,modeRef:d,pendingScrollFrameRef:j,pendingScrollToMessageRef:G,prependRestoreRef:N,preserveScrollOnPrependRef:B,rootRef:V,scrollEdgeThresholdRef:S,scrollMarginRef:x,scrollPreviousItemPeekRef:D,spacerGapRef:K,spacerHeightRef:A,spacerRef:z,stateFrameRef:H,stateStore:f,viewportRef:g,visibilityFrameRef:R,visibilityObserverRef:M,visibilityStore:k,visibleMessageIdsRef:q,handledScrollAnchorsRef:$}=s,Z=n.useRef(t);Z.current!==t&&(Z.current=t,T.current=!1);let _=n.useCallback(c=>{let i=V.current,p=g.current,O=[c.start&&"start",c.end&&"end"].filter(Boolean).join(" "),X=h.current;for(let F of[i,p])F&&(O?F.setAttribute("data-scrollable",O):F.removeAttribute("data-scrollable"),F.toggleAttribute("data-autoscrolling",X))},[]),de=n.useCallback(c=>{let i=g.current?.scrollTop??0,p=i<C.current-ae;C.current=i,a.current&&!c.end&&d.current!=="settling-jump"&&d.current!=="anchored-to-message"?d.current="following-bottom":d.current==="following-bottom"&&c.end&&p&&!h.current&&(d.current="free-scrolling")},[]),L=n.useCallback(()=>{let c=Ke({content:v.current,scrollEdgeThreshold:S.current,spacer:z.current,viewport:g.current});de(c);let i=d.current==="following-bottom"?{...c,end:!1}:c;_(i),f.setSnapshot(i)},[de,f,_]),J=n.useCallback(()=>{H.current===null&&(H.current=window.requestAnimationFrame(()=>{H.current=null,L()}))},[L]),E=n.useCallback(()=>{k.hasListeners()&&R.current===null&&(R.current=window.requestAnimationFrame(()=>{R.current=null,k.hasListeners()&&k.setSnapshot(Ze({content:v.current,scrollMargin:x.current,scrollPreviousItemPeek:D.current,spacer:z.current,viewport:g.current,visibleMessageIds:q.current}))}))},[k]),{flushPendingScrollToMessage:ne,reanchorToAnchoredMessage:ge,scrollToElement:Q,scrollToEnd:P,scrollToMessage:pe,scrollToStart:le}=at({refs:s,commitScrollState:L,scheduleStateCommit:J,scheduleVisibilitySync:E}),me=n.useCallback(()=>{let c=N.current,i=g.current;if(!c||!i||!c.element.isConnected)return!1;let p=se(c.element,i)-c.viewportTop;return Math.abs(p)<=ae?!1:(i.scrollTop+=p,c.viewportTop=se(c.element,i),J(),E(),!0)},[J,E]),W=n.useCallback(()=>{let c=v.current,i=g.current;if(!c||!i){N.current=null;return}let p=tt({content:c,spacer:z.current,viewport:i});N.current=p?{element:p,viewportTop:se(p,i)}:null},[]),be=n.useCallback(()=>{j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,ne()&&W()}))},[W,ne]),oe=n.useCallback(()=>{if(!t||T.current||b.current===0)return!1;let c=!1;if(t==="last-anchor"){let i=v.current,p=g.current,O=i&&p?et(ee(i,z.current)):null;if(!i||!p||!O)c=P({behavior:"auto"});else{let X=Ie(O,p);c=fe({content:i,spacer:z.current,viewport:p})-X<=p.clientHeight?P({behavior:"auto"}):Q(O,{align:"start"},{keepPreviousPeek:!0})}}else c=t==="end"?P({behavior:"auto"}):le({behavior:"auto"});return c?(T.current=!0,!0):!1},[t,Q,P,le]),he=n.useCallback(()=>{let c=v.current;if(!c)return;let i=ee(c,z.current),p=b.current,O=m.current;b.current=i.length,m.current=i[0]??null,(()=>{if(ne())return;if(p===0){if(oe()||i.length>0&&a.current&&P({behavior:"auto"}))return;L(),E();return}let X=O?i.indexOf(O):-1;if(B.current&&X>0){me();return}if(i.length>p){let F=Je(i,p);if(F){if(a.current&&d.current==="following-bottom"&&Xe(i,p)){P({behavior:"auto"});return}Q(F,{align:"start"},{keepPreviousPeek:!0}),$.current.add(F);return}}if(i.length===p){let F=Qe(i,$.current);if(F){Q(F,{align:"start"},{keepPreviousPeek:!0}),$.current.add(F);return}}d.current==="following-bottom"&&a.current?P({behavior:"auto"}):(L(),E())})(),W()},[oe,W,L,ne,me,E,Q,P]),ve=n.useCallback(()=>{if(d.current==="following-bottom"&&a.current){P({behavior:"auto"});return}let c=A.current;if(ge()){a.current&&c>0&&A.current===0&&P({behavior:"auto"});return}J(),E()},[ge,J,E,P]),Re=n.useCallback(()=>{let c=g.current;if(!(!c||!k.hasListeners())){if(typeof IntersectionObserver>"u"){E();return}M.current||(M.current=new IntersectionObserver(i=>{for(let p of i){let O=p.target.dataset.messageId;O&&(p.isIntersecting?q.current.add(O):q.current.delete(O))}E()},{root:c,rootMargin:`${-(x.current+D.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),I.current.forEach(i=>{M.current?.observe(i)}),E()}},[E,k]),we=n.useCallback(()=>{R.current!==null&&(window.cancelAnimationFrame(R.current),R.current=null),M.current?.disconnect(),M.current=null,q.current.clear(),k.setSnapshot(ue)},[k]),Fe=n.useCallback((c,i,p)=>{if(i){I.current.set(c,i),M.current?.observe(i),E(),G.current?.messageId===c&&be();return}p&&I.current.get(c)===p&&(I.current.delete(c),q.current.delete(c),M.current?.unobserve(p),E())},[be,E]),Se=n.useCallback(()=>{(d.current==="following-bottom"||d.current==="anchored-to-message"||d.current==="settling-jump")&&(u.current=null,d.current="free-scrolling")},[]),Ce=n.useCallback(()=>_(f.getSnapshot()),[f,_]),Te=xe(V,Ce),ke=xe(g,Ce),Me=n.useCallback(c=>{v.current=c},[]),ye=n.useCallback(c=>{z.current=c,K.current=st(c?.parentElement??null)},[]),Ee=n.useCallback(()=>{L(),E(),W()},[W,L,E]),Ne=n.useMemo(()=>({handleContentChange:he,handleResize:ve,observeVisibility:Re,preserveScrollOnPrependRef:B,scrollToEnd:P,scrollToMessage:pe,scrollToStart:le,setContentElement:Me,setRootElement:Te,setSpacerElement:ye,setViewportElement:ke,stateStore:f,syncAfterScroll:Ee,unobserveVisibility:we,userScrollIntent:Se,viewportRef:g,visibilityStore:k}),[he,ve,Re,P,pe,le,Me,Te,ye,ke,f,Ee,we,Se,k]);return n.useLayoutEffect(()=>{oe()},[oe]),n.useEffect(()=>()=>{H.current!==null&&(window.cancelAnimationFrame(H.current),H.current=null),R.current!==null&&(window.cancelAnimationFrame(R.current),R.current=null),w.current!==null&&(window.clearTimeout(w.current),w.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),M.current?.disconnect(),M.current=null},[]),n.useLayoutEffect(()=>{if(e&&d.current==="following-bottom"&&b.current>0){P({behavior:"auto"});return}L()},[e,L,P]),{context:Ne,registerMessage:Fe}}function pt(e){let t=n.useRef(e);return t.current=e,t}var Oe=n.createContext(null),Be=n.createContext(null);function U(){let e=n.useContext(Oe);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function mt(){let e=n.useContext(Be);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function Tt(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:r}=U();return n.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:r}),[e,t,r])}function kt(){let{stateStore:e}=U();return n.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Mt(){let{observeVisibility:e,unobserveVisibility:t,visibilityStore:r}=U(),l=n.useCallback(o=>r.subscribe(o,e,t),[e,t,r]);return n.useSyncExternalStore(l,r.getSnapshot,r.getSnapshot)}function bt({autoScroll:e=!1,children:t,defaultScrollPosition:r="end",scrollEdgeThreshold:l,scrollPreviousItemPeek:o,scrollMargin:s}){let{context:u,registerMessage:a}=gt({autoScroll:e,defaultScrollPosition:r,scrollEdgeThreshold:l,scrollPreviousItemPeek:o,scrollMargin:s});return y.jsx(Oe.Provider,{value:u,children:y.jsx(Be.Provider,{value:a,children:t})})}function ht({children:e,...t}){let{setRootElement:r}=U();return y.jsx("div",{ref:r,...t,children:e})}function vt({"aria-label":e,children:t,onKeyDown:r,onScroll:l,onTouchMove:o,onWheel:s,preserveScrollOnPrepend:u=!0,ref:a,role:h,tabIndex:w,...v}){let{handleResize:T,preserveScrollOnPrependRef:m,setViewportElement:b,syncAfterScroll:C,userScrollIntent:I,viewportRef:d}=U();m.current=u;let j=n.useCallback(S=>{b(S),re(a)?.(S)},[a,b]);function G(S){C(),l?.(S)}function N(S){I(),s?.(S)}function B(S){I(),o?.(S)}function V(S){We.has(S.key)&&I(),r?.(S)}return n.useEffect(()=>{let S=d.current;if(!S||typeof ResizeObserver>"u")return;let x=0,D=new ResizeObserver(()=>{window.cancelAnimationFrame(x),x=window.requestAnimationFrame(T)});return D.observe(S),()=>{window.cancelAnimationFrame(x),D.disconnect()}},[T,d]),y.jsx("div",{ref:j,role:h??"region","aria-label":e??"Messages",tabIndex:w??0,onKeyDown:V,onScroll:G,onTouchMove:B,onWheel:N,...v,children:t})}function Rt({"aria-relevant":e,children:t,ref:r,role:l,spacerClassName:o,...s}){let{handleContentChange:u,handleResize:a,setContentElement:h,setSpacerElement:w}=U(),v=n.useRef(null),T=n.useCallback(m=>{v.current=m,h(m),re(r)?.(m)},[r,h]);return n.useLayoutEffect(()=>{let m=v.current;if(!m||(u(),typeof MutationObserver>"u"))return;let b=new MutationObserver(()=>{u()});return b.observe(m,{childList:!0}),()=>b.disconnect()},[u]),n.useEffect(()=>{let m=v.current;if(!m||typeof ResizeObserver>"u")return;let b=0,C=new ResizeObserver(()=>{window.cancelAnimationFrame(b),b=window.requestAnimationFrame(a)});return C.observe(m),()=>{window.cancelAnimationFrame(b),C.disconnect()}},[a]),y.jsxs("div",{ref:T,role:l??"log","aria-relevant":e??"additions",...s,children:[t,y.jsx("div",{ref:w,"aria-hidden":"true","data-message-scroller-spacer":"",hidden:!0,className:o})]})}function wt({messageId:e,ref:t,scrollAnchor:r=!1,...l}){let o=mt(),s=n.useRef(null),u=n.useCallback(a=>{let h=s.current;s.current=a,e&&o(e,a,h),re(t)?.(a)},[e,t,o]);return y.jsx("div",{ref:u,"data-message-id":e,"data-scroll-anchor":r?"true":"false",...l})}function St({behavior:e="smooth",children:t,direction:r="end",onClick:l,render:o,tabIndex:s,type:u="button",...a}){let{scrollToEnd:h,scrollToStart:w,stateStore:v}=U(),T=pt(l),m=n.useCallback(d=>v.subscribe(d),[v]),b=n.useCallback(()=>{let d=v.getSnapshot();return r==="start"?d.start:d.end},[r,v]),C=n.useSyncExternalStore(m,b,b),I=n.useCallback(d=>{C&&(T.current?.(d),d.defaultPrevented||(d.currentTarget.blur(),r==="start"?w({behavior:e}):h({behavior:e})))},[e,r,C,T,h,w]);return Le({defaultTagName:"button",props:ce({type:u,inert:!C,tabIndex:C?s:-1,children:t??y.jsxs("span",{children:["Scroll to ",r]}),onClick:I},a),render:o,state:{active:C,direction:r},stateAttributesMapping:{active:d=>({"data-active":d?"true":"false"})}})}var Y={Provider:bt,Root:ht,Viewport:vt,Content:Rt,Item:wt,Button:St};function yt(e){return y.jsx(Y.Provider,{...e})}function Et({className:e,...t}){return y.jsx(Y.Root,{"data-slot":"message-scroller",className:te("group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",e),...t})}function xt({className:e,...t}){return y.jsx(Y.Viewport,{"data-slot":"message-scroller-viewport",className:te("size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-none",e),...t})}function Pt({className:e,...t}){return y.jsx(Y.Content,{"data-slot":"message-scroller-content",className:te("flex h-max min-h-full flex-col gap-8",e),...t})}function It({className:e,scrollAnchor:t=!1,...r}){return y.jsx(Y.Item,{"data-slot":"message-scroller-item",scrollAnchor:t,className:te("min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",e),...r})}function At({direction:e="end",className:t,children:r,render:l,variant:o="secondary",size:s="icon-sm",...u}){return y.jsx(Y.Button,{"data-slot":"message-scroller-button","data-direction":e,"data-variant":o,"data-size":s,direction:e,className:te("absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",t),render:l??y.jsx(He,{variant:o,size:s}),...u,children:r??y.jsxs(y.Fragment,{children:[y.jsx(ze,{}),y.jsx("span",{className:"sr-only",children:e==="end"?"Scroll to end":"Scroll to start"})]})})}export{Et as MessageScroller,At as MessageScrollerButton,Pt as MessageScrollerContent,It as MessageScrollerItem,yt as MessageScrollerProvider,xt as MessageScrollerViewport,Tt as useMessageScroller,kt as useMessageScrollerScrollable,Mt as useMessageScrollerVisibility};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ad as o}from"../../js/index-C4LjLCAZ.js";const n="rbnode-",a="rb-empty",s=new RegExp(`(?:^|\\s)(${n}[0-9a-z]{8})(?:\\s|$)`);function c(e){return`${n}${e}`}function u(e){if(!e.startsWith(n))return null;const t=e.slice(n.length);return o.test(t)?t:null}function d(e){return s.exec(e)?.[1]??null}export{a as E,n as N,u as d,c as e,d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b4 as S,b5 as b,b6 as u,b7 as f,ak as a,b8 as g,b9 as O}from"../../js/index-C4LjLCAZ.js";const L=new Set(["FileUpload","FileUploadAvatar","Attachment"]),k=new Set(["SelectMulti","ComboboxMulti","NativeSelectMulti","ToggleGroupMulti","MultiSelect"]),P=new Set(["Checkbox","Switch","Toggle"]),p=["options","items","data","dataSource","choices","list"];function w(o){const t=a(o.component)?.arg;if(t!==void 0){if(L.has(t))return"file";if(k.has(t))return"multi";if(P.has(t))return"boolean";if(t==="Slider")return"number"}if(o.componentProps?.type==="number")return"number";const e=o.componentProps??{};for(const n of p)if(e[n]!==void 0)return"select";return"string"}function N(o){switch(w(o)){case"file":case"multi":return null;case"boolean":return!1;case"number":{const t=o.componentProps?.min;return typeof t=="number"?t:null}default:return""}}function v(o){const t=[],e=n=>{if(f(n)){const i=a(n.array);i?.op==="model"&&t.push({path:i.arg,value:[]});return}if(g(n)){const i=a(n.value);i?.op==="model"&&t.push({path:i.arg,value:N(n)});return}if(O(n)){const i=n;i.children?.forEach(s=>{u(s)&&e(s)});const r=i.componentProps?.steps;Array.isArray(r)&&r.forEach(s=>{u(s)&&e(s)})}};return u(o.root)&&e(o.root),t}function y(o,t,e){let n=o;for(let r=0;r<t.length-1;r+=1){const s=t[r];(typeof n[s]!="object"||n[s]===null)&&(n[s]={}),n=n[s]}const i=t[t.length-1];i in n||(n[i]=e)}function F(o){const t={};for(const{path:e,value:n}of o)y(t,e.split("."),n);return t}function E(o){const t=new Set(S(o).dataSources),e=new Set,n=new Set;b(o,r=>{const s=r.componentProps;if(s!==void 0){if(f(r)){const c=a(s.itemLabel);c?.op==="dataSource"&&e.add(c.arg)}for(const c of p){const l=a(s[c]);l?.op==="dataSource"&&n.add(l.arg)}}});for(const r of e)n.delete(r);const i=new Set;for(const r of t)!e.has(r)&&!n.has(r)&&i.add(r);return{functionLike:e,optionLike:n,scalarLike:i}}function M(o){const t=x(o);return[1,2,3].map(e=>({value:`option${e}`,label:`${t} ${e}`}))}function x(o){const t=o.replace(/[_-]+/g," ").replace(/([a-z\d])([A-Z])/g,"$1 $2").trim().toLowerCase();return t===""?o:t.charAt(0).toUpperCase()+t.slice(1)}function I(o){const t=E(o),e={};for(const n of t.optionLike)e[n]=M(n);for(const n of t.scalarLike)e[n]="значение";return{model:F(v(o)),dataSources:e}}const m="fixture.ts";function d(o){const t=[];for(const e of o.replace(/\\/g,"/").split("/"))if(!(e===""||e===".")){if(e===".."){if(t.length===0)return null;t.pop();continue}t.push(e)}return t.join("/")}function h(o){const t=o.lastIndexOf("/");return t<0?"":o.slice(0,t)}function T(o){const t=d(o);return t===null||t===""?null:h(t)}function A(o,t){return o===""?t:`${o}/${t}`}function _(o){const t=T(o);return t===null?null:A(t,m)}function $(o){const t=d(o);if(t===null)return!1;const e=h(t);return t.slice(e===""?0:e.length+1)===m}export{m as F,p as L,_ as a,E as c,w as f,$ as i,M as m,I as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const i=["hideWhen","onEvent","patchProps"];function t(){return{validation:[],behavior:[],render:[]}}function o(e){return(e?.validation.length??0)>0}function r(e){return(e?.behavior.length??0)>0}function a(e){return e.render.filter(n=>n.kind==="hideWhen").map(n=>({selector:n.selector,condition:n.condition}))}export{i as R,
|
|
1
|
+
const i=["hideWhen","onEvent","patchProps"];function t(){return{validation:[],behavior:[],render:[]}}function o(e){return(e?.validation.length??0)>0}function r(e){return(e?.behavior.length??0)>0}function a(e){return e.render.filter(n=>n.kind==="hideWhen").map(n=>({selector:n.selector,condition:n.condition}))}export{i as R,r as a,t as e,o as h,a as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bl as l,bm as g,bn as x,bo as a,bp as N,bq as O,b9 as y,br as C,bs as k,bt as S,bu as $,a7 as D,bv as I,ak as R,bw as _,bx as L}from"../../js/index-C4LjLCAZ.js";import{k as b}from"../reformer-builder-toolkit/naming-9aaM0Wbc.js";const T=["Control","Options","Textfield","Behavior","State"];function B(t){const e=t.properties??{},n=[];for(const[r,o]of Object.entries(e)){const s=o["x-doc"];n.push({key:r,label:j(r),widget:r==="iconName"?"icon":r==="className"?"className":r==="testId"?"text":s?.group==="Options"&&o.type==="array"?"dataSource":s?.kind??U(o),group:s?.group??"Control",description:typeof o.description=="string"?o.description:void 0,default:o.default,options:Array.isArray(o.enum)?o.enum:void 0,min:typeof o.minimum=="number"?o.minimum:void 0,max:typeof o.maximum=="number"?o.maximum:void 0,step:typeof o.multipleOf=="number"?o.multipleOf:void 0})}return n}function E(t){const e=new Map;for(const n of t){const r=e.get(n.group)??[];r.push(n),e.set(n.group,r)}return T.filter(n=>e.has(n)).map(n=>({group:n,props:e.get(n)}))}function K(t){return E(B(t))}function U(t){if(Array.isArray(t.enum))return"enum";const e=t.type;return e==="boolean"?"boolean":e==="number"||e==="integer"?"number":"text"}function j(t){return t.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/^./,e=>e.toUpperCase()).trim()}const f=t=>structuredClone(t),Z="flex gap-4",q="flex flex-col gap-4";function A(t){if(!t||!y(t))return!1;const e=t;if(e.component!=="$html(div)")return!1;const n=e.children;if(!Array.isArray(n)||n.length!==1)return!1;const r=e.componentProps?.className;if(typeof r!="string")return!1;const o=r.split(/\s+/);return o.includes("flex")||o.includes("grid")}function H(t,e,n,r){return{schema:l(t,[...e,"componentProps"],s=>{const i={...s};return r===void 0?delete i[n]:i[n]=r,i}),newPath:e}}function h(t,e,n,r){return{schema:l(t,e,s=>{const i={...s};return r===void 0?delete i[n]:i[n]=r,i}),newPath:e}}function J(t,e,n){return{schema:l(t,e,o=>{const s={...o},i=Array.isArray(s.children)?[...s.children]:[],c=i.findIndex(u=>typeof u=="string"||typeof u=="number");return n===""?c>=0&&i.splice(c,1):c>=0?i[c]=n:i.unshift(n),i.length===0&&!Array.isArray(s.children)?delete s.children:s.children=i,s}),newPath:e}}function Q(t){const e=t.children;if(!Array.isArray(e))return-1;const n=e.reduce((r,o,s)=>((typeof o=="string"||typeof o=="number")&&r.push(s),r),[]);return n.length>1?null:n.length===1?n[0]:-1}function V(t,e,n){return h(t,e,"component",n)}function w(t,e,n,r){let o=n;return{schema:l(t,e,i=>{const c=Array.isArray(i)?i.slice():[],u=Math.max(0,Math.min(n,c.length));return o=u,c.splice(u,0,r),c}),newPath:[...e,o]}}function X(t,e){const n=g(t,e),r=x(e)??["root"],o=a(n,r);if(A(o)){const s=o.children[0];return{schema:l(n,r,()=>f(s)),newPath:r}}return{schema:n,newPath:r}}function Y(t,e,n,r){const o=a(t,e);if(!o)return{schema:t,newPath:e};const s=f(o);let i=g(t,e);const c=x(e);if(c&&!N(c,n)){const d=a(i,c);if(A(d)){const v=d.children[0];i=l(i,c,()=>f(v))}}const u=e.slice(0,-1),m=Number(e[e.length-1]);let p=r;return O(u,n)&&m<r&&(p=r-1),w(i,n,p,s)}function ee(t,e){const n=a(t,e),r=e.slice(0,-1),o=Number(e[e.length-1]),s=a(t,r);return!n||!Array.isArray(s)?{schema:t,newPath:e}:w(t,r,o+1,f(n))}function ne(t,e,n,r,o){const s=a(t,e);if(!Array.isArray(s)||r<1)return{schema:t,newPath:[...e,n]};const i=s.slice(n,n+r).map(f),c={component:"$html(div)",componentProps:{className:o?.className??q},children:i};return{schema:l(t,e,m=>{const p=m.slice();return p.splice(n,r,c),p}),newPath:[...e,n]}}function te(t,e){const n=a(t,e);if(!n||!k(n))return{schema:t,newPath:e};const r=n.children,o=e.slice(0,-1),s=e[e.length-1];return!Array.isArray(r)||typeof s!="number"?{schema:t,newPath:e}:{schema:l(t,o,c=>{const u=c.slice();return u.splice(s,1,...r.map(f)),u}),newPath:[...o,s]}}function z(t,e){const n=(t??"").split(/\s+/).filter(Boolean).filter(r=>r==="flex"||!S(r));return n.includes("flex")||n.unshift("flex"),e||n.splice(n.indexOf("flex")+1,0,"flex-col"),n.join(" ")}function re(t,e){const n=a(t,e);if(!n||!y(n))return{schema:t,newPath:e};const r=n.componentProps?.className,o=z(typeof r=="string"?r:void 0,C(n)!=="horizontal");return{schema:l(t,e,i=>{const c=i;return{...c,componentProps:{...c.componentProps??{},className:o}}}),newPath:e}}function F(t){const e=t.selector;return typeof e=="string"&&e?e:void 0}function G(t){const e=I(t),n=R(e),r=n?.op==="html"?n.arg:e,o=_(t)??L(t)??r??"node";return b(o)||"node"}function M(t,e,n){const r=new Set(D(t)),o=b(e)||"node";if(!r.has(o))return o;let s=2;for(;r.has(`${o}-${s}`);)s+=1;return`${o}-${s}`}function oe(t,e){const n=$(t,e);if(!n)return null;const r=F(n);if(r)return{schema:t,selector:r,created:!1};const o=M(t,G(n));return{schema:h(t,e,"selector",o).schema,selector:o,created:!0}}export{Z as D,J as a,h as b,H as c,w as d,F as e,re as f,ne as g,K as h,A as i,q as j,B as k,ee as l,Y as m,oe as n,X as r,V as s,Q as t,te as u};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const s="// @reformer-generated",c=new Set(["ts","tsx","js","jsx","mjs","cjs","mts","cts","css","scss"]);function l(t){const e=t.lastIndexOf(".");return e===-1?!1:c.has(t.slice(e+1).toLowerCase())}function i(t){let e=2166136261;for(let n=0;n<t.length;n+=1)e^=t.charCodeAt(n),e=Math.imul(e,16777619)>>>0;let r=2646966556;for(let n=t.length-1;n>=0;n-=1)r^=t.charCodeAt(n),r=Math.imul(r,16777619)>>>0;return(e.toString(16).padStart(8,"0")+r.toString(16).padStart(8,"0")).slice(0,12)}function a(t){return t.startsWith(s)?t.slice(t.indexOf(`
|
|
2
|
+
`)+1):t}function d(t){const e=a(t);return`${s} ${i(e)}
|
|
3
|
+
${e}`}function o(t){return t==null||!t.startsWith(s)?"handwritten":t.slice(0,t.indexOf(`
|
|
4
|
+
`)).slice(s.length).trim()===i(a(t))?"generated":"edited"}function u(t){return o(t)==="generated"}export{l as a,u as i,d as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Y as n,Z as c,a8 as k,a9 as V,aa as J,ab as K,ac as O}from"../../js/index-C4LjLCAZ.js";const L=n.createContext(null);function v(){const t=n.useContext(L);if(!t)throw new Error("useFormWizard must be used within FormWizard");return t}function j({component:t,control:e,children:i,_stepIndex:s,...a}){const{currentStep:p}=v();return s===void 0||p!==s?null:i!==void 0?c.jsx(c.Fragment,{children:i}):t&&e?c.jsx(t,{control:e,...a}):null}j.displayName="FormWizard.Step";function R({steps:t,children:e}){if(typeof e!="function")throw new Error("FormWizard.Indicator requires children as a render function. Example: <FormWizard.Indicator steps={STEPS}>{({ steps }) => <YourUI />}</FormWizard.Indicator>");const{currentStep:i,totalSteps:s,completedSteps:a,goToStep:p}=v(),d={steps:t.map(o=>({...o,isCurrent:i===o.number,isCompleted:a.includes(o.number),canNavigate:o.number===1||a.includes(o.number-1)})),goToStep:p,currentStep:i,totalSteps:s,completedSteps:a};return c.jsx(c.Fragment,{children:e(d)})}R.displayName="FormWizard.Indicator";const M=n.createContext(null);function Q(){const t=n.useContext(M);if(!t)throw new Error("FormWizard.Prev/Next/Submit must be used within FormWizard.Actions. Wrap your navigation buttons with <FormWizard.Actions>.");return t}function X(t){return typeof t=="function"}function Y({onSubmit:t,children:e,className:i,style:s}){const{isFirstStep:a,isLastStep:p,isValidating:d,isSubmitting:o,goToNextStep:r,goToPreviousStep:f,submit:u}=v(),S=n.useMemo(()=>({onSubmit:t}),[t]);if(X(e)){const b=d||o;return c.jsx(c.Fragment,{children:e({prev:{onClick:f,disabled:b},next:{onClick:()=>r(),disabled:b},submit:{onClick:()=>{u(()=>t?.())},disabled:b,isSubmitting:o},isFirstStep:a,isLastStep:p,isValidating:d,isSubmitting:o})})}return c.jsx(M.Provider,{value:S,children:i||s?c.jsx("div",{className:i,style:s,children:e}):c.jsx(c.Fragment,{children:e})})}Y.displayName="FormWizard.Actions";function $({children:t}){if(typeof t!="function")throw new Error("FormWizard.Progress requires children as a render function. Example: <FormWizard.Progress>{({ current, total }) => <YourUI />}</FormWizard.Progress>");const{currentStep:e,totalSteps:i,completedSteps:s,isFirstStep:a,isLastStep:p}=v(),d={current:e,total:i,percent:i>0?Math.round(e/i*100):0,completedCount:s.length,isFirstStep:a,isLastStep:p};return c.jsx(c.Fragment,{children:t(d)})}$.displayName="FormWizard.Progress";const q=n.forwardRef(({children:t,asChild:e=!1,disabled:i,...s},a)=>{const{goToPreviousStep:p,isFirstStep:d,isValidating:o,isSubmitting:r}=v();return c.jsx(e?k:"button",{ref:a,type:e?void 0:"button",onClick:p,disabled:i||d||o||r,"data-first-step":d||void 0,...s,children:t})});q.displayName="FormWizard.Prev";const U=n.forwardRef(({children:t,asChild:e=!1,disabled:i,...s},a)=>{const{goToNextStep:p,isLastStep:d,isValidating:o,isSubmitting:r}=v();return c.jsx(e?k:"button",{ref:a,type:e?void 0:"button",onClick:()=>p(),disabled:i||d||o||r,"data-last-step":d||void 0,...s,children:t})});U.displayName="FormWizard.Next";const _=n.forwardRef(({children:t,asChild:e=!1,disabled:i,loadingText:s,...a},p)=>{const{isLastStep:d,isValidating:o,isSubmitting:r,submit:f}=v(),{onSubmit:u}=Q(),S=i||!d||o||r,b=e?k:"button",g=r&&s;let y=t;return e&&g&&n.isValidElement(t)&&(y=n.cloneElement(t,{},s)),c.jsx(b,{ref:p,type:e?void 0:"submit",onClick:()=>{f(()=>u?.())},disabled:S,"data-submitting":r||void 0,"data-not-last-step":!d||void 0,...a,children:e?y:g?s:t})});_.displayName="FormWizard.Submit";function I(t,e){return t.filter(i=>i<e)}const B={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function D({form:t,config:e,children:i,onStepChange:s,scrollToTop:a=!0},p){const d=l=>{let m=0;return n.Children.forEach(l,h=>{if(n.isValidElement(h))if(h.type===j)m+=1;else{const A=h.props;A.children&&(m+=d(A.children))}}),m},o=d(i),[r,f]=n.useState(1),[u,S]=n.useState([]),[b,g]=n.useState(!1),y=t.submitting.value,F=n.useCallback(async()=>{if(!e.validateStep)return console.warn(`No validateStep callback configured for step ${r}`),!0;g(!0);try{return await e.validateStep(r)}finally{g(!1)}},[r,e]),w=n.useCallback(async()=>{if(!await F())return t.markAsTouched(),!1;if(u.includes(r)||S(l=>[...l,r]),r<o){const l=r+1;f(l),s?.(l),a&&window.scrollTo({top:0,behavior:"smooth"})}return!0},[F,r,u,o,t,s,a]),C=n.useCallback(()=>{if(r>1){const l=r-1;f(l),S(m=>I(m,l)),s?.(l),a&&window.scrollTo({top:0,behavior:"smooth"})}},[r,s,a]),T=n.useCallback(l=>(l===1||u.includes(l-1))&&l>=1&&l<=o?(l<r&&S(m=>I(m,l)),f(l),s?.(l),a&&window.scrollTo({top:0,behavior:"smooth"}),!0):!1,[u,o,r,s,a]),z=n.useCallback(async l=>{g(!0);try{return!e.validateAll||await e.validateAll()?t.submit(l,{skipValidation:!0}):(t.markAsTouched(),null)}finally{g(!1)}},[t,e]),W=r===1,N=r===o;n.useImperativeHandle(p,()=>({form:t,currentStep:r,completedSteps:u,validateCurrentStep:F,goToNextStep:w,goToPreviousStep:C,goToStep:T,submit:z,isFirstStep:W,isLastStep:N,isValidating:b}),[t,r,u,F,w,C,T,z,W,N,b]);const H=n.useMemo(()=>({currentStep:r,totalSteps:o,completedSteps:u,isFirstStep:W,isLastStep:N,isValidating:b,isSubmitting:y,form:t,goToNextStep:w,goToPreviousStep:C,goToStep:T,submit:z}),[r,o,u,W,N,b,y,t,w,C,T,z]);let E=0;const P=l=>n.Children.map(l,m=>{if(!n.isValidElement(m))return m;const h=m.props;return m.type===j?(E+=1,n.cloneElement(m,{...h,_stepIndex:E})):typeof h.children=="function"?m:h.children?n.cloneElement(m,{...h,children:P(h.children)}):m}),Z=P(i),G=H;return c.jsxs(L.Provider,{value:G,children:[c.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",style:B,children:`Step ${r} of ${o}`}),Z]})}const tt=n.forwardRef(D),x=tt;x.Step=j;x.Indicator=R;x.Actions=Y;x.Progress=$;x.Prev=q;x.Next=U;x.Submit=_;function rt(t,e){const i=Object.keys(e.steps),s=()=>{},a=i.map(f=>e.steps[f]).filter(f=>f!=null),p=K(()=>O(...a,...e.extras?[e.extras]:[])),{strategy:d,debounce:o,liveAfterSubmit:r}=e;return{stepSelectors:i,validateStep:f=>{const u=i[f-1],S=(u!=null?e.steps[u]:null)??s;return V(t,S,{touch:!0})},validateAll:()=>V(t,p,{touch:!0}),createStepController:f=>{if(!d||d==="submit")return null;const u=i[f-1],S=u!=null?e.steps[u]:null;return S==null?null:J(t,S,{strategy:d,debounce:o,liveAfterSubmit:r})}}}export{Y as J,$ as K,j as N,q as Q,L as U,v as W,U as X,R as Y,_ as Z,Q as a,rt as f,x as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Y as s,Z as m,gB as Ye,a8 as W}from"../../js/index-C4LjLCAZ.js";const fe=s.createContext(null);function S(){const t=s.useContext(fe);if(!t)throw new Error("FileUpload.* components must be used within <FileUpload.Root>. Wrap your slots with <FileUpload.Root>.");return t}const ge=s.createContext(null);function B(){const t=s.useContext(ge);if(!t)throw new Error("FileUpload.Item* components must be used within <FileUpload.Item>.");return t}function ye(){return{items:[],rejections:[]}}function ce(t,r){switch(r.kind){case"add":{const e=r.accepted.map((n,i)=>({key:r.keys[i],status:"local",file:n}));return{items:r.replace?e:[...t.items,...e],rejections:r.rejected}}case"remove":{const e=t.items.filter(n=>n.key!==r.key);return e.length===t.items.length?t:{...t,items:e}}case"clear":return ye();case"upload-start":return K(t,r.key,e=>e.status==="local"||e.status==="error"?{key:e.key,status:"uploading",file:e.file,progress:0}:e);case"upload-progress":return K(t,r.key,e=>e.status==="uploading"?{...e,progress:Ze(r.percent)}:e);case"upload-success":return K(t,r.key,e=>e.status==="uploading"?{key:e.key,status:"uploaded",file:e.file,remote:r.remote}:e);case"upload-error":return K(t,r.key,e=>e.status==="uploading"?{key:e.key,status:"error",file:e.file,error:r.error,progress:e.progress}:e);case"retry":return K(t,r.key,e=>e.status==="error"?{key:e.key,status:"local",file:e.file}:e);case"sync-items":return{...t,items:r.items}}}function K(t,r,e){let n=!1;const i=t.items.map(u=>{if(u.key!==r)return u;const k=e(u);return k!==u&&(n=!0),k});return n?{...t,items:i}:t}function Ze(t){return Number.isNaN(t)?0:Math.min(100,Math.max(0,t))}function j(t,r){return{code:t,message:"invalid",params:r}}function Je(t,r,e){const{accept:n,multiple:i=!1,maxFiles:u,maxFileSize:k,minFileSize:T,maxTotalFileSize:N,preventDuplicates:U=!0,validate:Y}=r,Z=i?u??1/0:1,D=e.length,X=e.reduce((c,p)=>c+Qe(p),0),v=[],f=[];let J=0;for(const c of t){const p=[];n&&!Ye(c,n)&&p.push(j("fileType",{accept:n,fileName:c.name})),typeof k=="number"&&c.size>k&&p.push(j("maxFileSize",{maxFileSize:k,fileName:c.name,actualSize:c.size})),typeof T=="number"&&c.size<T&&p.push(j("minFileSize",{minFileSize:T,fileName:c.name,actualSize:c.size})),U&&Ve(c,e,v)&&p.push(j("fileExists",{fileName:c.name}));const Q=Y?.(c,{existing:e});Q?.length&&p.push(...Q),p.length===0&&(D+v.length+1>Z?p.push(j("maxFiles",{maxFiles:Z,fileName:c.name})):typeof N=="number"&&X+J+c.size>N&&p.push(j("maxTotalFileSize",{maxTotalFileSize:N,fileName:c.name}))),p.length>0?f.push({file:c,errors:p}):(v.push(c),J+=c.size)}return{accepted:v,rejected:f}}function Qe(t){return t.status==="uploaded"?t.file?.size??t.remote.size??0:t.file.size}function Ve(t,r,e){const n=(i,u)=>i===t.name&&u===t.size;return r.some(i=>i.status==="uploaded"?n(i.file?.name??i.remote.name,i.file?.size??i.remote.size):n(i.file.name,i.file.size))||e.some(i=>n(i.name,i.size))}function re(t,r){if(r==="remote"){const n=t.flatMap(i=>i.status==="uploaded"?[i.remote]:[]);return n.length>0?n:null}const e=t.flatMap(n=>n.file?[n.file]:[]);return e.length>0?e:null}function de(t,r,e,n){return r===null||r.length===0?[]:e==="remote"?r.map(i=>t.find(u=>u.status==="uploaded"&&u.remote.id===i.id)??{key:`remote:${i.id}`,status:"uploaded",remote:i}):r.map(i=>t.find(u=>u.file===i)??{key:n(i),status:"local",file:i})}function Xe(t,r){return`${r}:${t.name}:${t.size}:${t.lastModified??""}`}const me=["Б","КБ","МБ","ГБ","ТБ"];function qe(t){if(!Number.isFinite(t)||t<0)return"";let r=t,e=0;for(;r>=1024&&e<me.length-1;)r/=1024,e+=1;const n=e===0?r:Math.round(r*10)/10;return`${Number.isInteger(n)?String(n):n.toFixed(1)} ${me[e]}`}const pe={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function ae(t){return t.status==="uploaded"?t.file?.name??t.remote.name:t.file.name}function le(t,r){return t===r?!0:!Array.isArray(t)||!Array.isArray(r)?!1:t.length===r.length&&t.every((e,n)=>e===r[n])}function _e(t){const{value:r,disabled:e=!1,accept:n,multiple:i=!1,maxFiles:u,allowDrop:k=!0,allowPaste:T=!1,capture:N,uploader:U,autoUpload:Y=!0,id:Z}=t,D=U?"remote":"local",X=s.useRef(0),v=s.useCallback(a=>Xe(a,++X.current),[]),[f,J]=s.useReducer(ce,void 0,()=>r!=null&&r.length>0?{items:de([],r,U?"remote":"local",v),rejections:[]}:ye()),[c,p]=s.useState(!1),[Q,se]=s.useState(!1),[we,$]=s.useState(""),F=s.useRef(t);F.current=t;const x=s.useRef(f);x.current=f;const V=s.useRef(null),g=s.useRef(new Map),E=s.useRef(new Map),O=s.useRef(0),G=s.useRef(void 0),Pe=s.useId(),H=Z??Pe,z=s.useMemo(()=>Object.freeze({root:`file-upload-${H}`,hiddenInput:`file-upload-input-${H}`,dropzone:`file-upload-dropzone-${H}`,liveRegion:`file-upload-live-${H}`}),[H]),y=s.useCallback(a=>{const l=ce(x.current,a);return x.current=l,J(a),l},[]),I=s.useCallback(a=>{const l=E.current.get(a);l!==void 0&&(E.current.delete(a),URL.revokeObjectURL(l))},[]),q=s.useRef(U);q.current=U;const w=s.useCallback(a=>{const l=re(a,q.current?"remote":"local");le(l,G.current)||(G.current=l,F.current.onChange?.(l))},[]),ie=s.useCallback((a,l)=>{const o=q.current;if(!o)return;const C=new AbortController;g.current.set(a,C),y({kind:"upload-start",key:a});let h=0;o(l,{onProgress:d=>{const R=Date.now();d<100&&R-h<100||(h=R,y({kind:"upload-progress",key:a,percent:d}))},signal:C.signal}).then(d=>{g.current.delete(a);const R=y({kind:"upload-success",key:a,remote:d}),A=R.items.find(P=>P.key===a);A?.status==="uploaded"&&(F.current.onUploadSuccess?.(A),$(`Файл ${l.name} загружен`),w(R.items))},d=>{g.current.delete(a);const R=C.signal.aborted||d instanceof Error&&d.name==="AbortError",A=R?j("uploadAborted",{fileName:l.name}):j("uploadFailed",{fileName:l.name,reason:d instanceof Error?d.message:String(d)}),P=y({kind:"upload-error",key:a,error:A}).items.find(We=>We.key===a);P?.status==="error"&&(F.current.onUploadError?.(P),$(R?`Загрузка ${l.name} прервана`:`Ошибка загрузки ${l.name}`))})},[y,w]);s.useEffect(()=>{if(!(!U||!Y))for(const a of f.items)a.status==="local"&&!g.current.has(a.key)&&ie(a.key,a.file)},[f.items,U,Y,ie]);const L=s.useCallback(a=>{const l=F.current;if(l.disabled||a.length===0)return;const o=!(l.multiple??!1),C=o?[]:x.current.items,{accepted:h,rejected:d}=Je(a,{accept:l.accept,multiple:l.multiple,maxFiles:l.maxFiles,maxFileSize:l.maxFileSize,minFileSize:l.minFileSize,maxTotalFileSize:l.maxTotalFileSize,preventDuplicates:l.preventDuplicates,validate:l.validate},C);if(o)for(const P of x.current.items)g.current.get(P.key)?.abort(),g.current.delete(P.key),I(P.key);const R=h.map(v),A=y({kind:"add",accepted:h,keys:R,rejected:d,replace:o});h.length>0&&(l.onAccept?.(h),$(h.length===1?`Файл ${h[0].name} добавлен`:`Добавлено файлов: ${h.length}`)),d.length>0&&(l.onReject?.(d),$(d.length===1?`Файл ${d[0].file.name} отклонён`:`Отклонено файлов: ${d.length}`)),w(A.items)},[y,w,v,I]),_=s.useCallback(a=>{g.current.get(a)?.abort(),g.current.delete(a),I(a);const l=x.current.items.find(C=>C.key===a),o=y({kind:"remove",key:a});l&&$(`Файл ${ae(l)} удалён`),w(o.items)},[y,w,I]),ee=s.useCallback(()=>{for(const[,l]of g.current)l.abort();g.current.clear();for(const[l]of E.current)I(l);const a=y({kind:"clear"});$("Список файлов очищен"),w(a.items)},[y,w,I]),te=s.useCallback(a=>{y({kind:"retry",key:a})},[y]),je=s.useCallback(a=>{if(a!==void 0){g.current.get(a)?.abort();return}for(const[,l]of g.current)l.abort()},[]),M=s.useCallback(()=>{F.current.disabled||V.current?.click()},[]),Se=s.useCallback(()=>{V.current?.focus()},[]),Te=s.useCallback(a=>{const l=x.current.items.find(h=>h.key===a);if(!l)return null;if(!l.file)return l.status==="uploaded"?l.remote.url??null:null;const o=E.current.get(a);if(o!==void 0)return o;if(typeof URL>"u"||typeof URL.createObjectURL!="function")return null;const C=URL.createObjectURL(l.file);return E.current.set(a,C),C},[]);s.useEffect(()=>{if(r===void 0||le(r,G.current))return;if(le(r,re(x.current.items,D))){G.current=r;return}const a=de(x.current.items,r,D,v),l=new Set(a.map(o=>o.key));for(const o of x.current.items)l.has(o.key)||(g.current.get(o.key)?.abort(),g.current.delete(o.key),I(o.key));y({kind:"sync-items",items:a}),G.current=re(a,D)},[r,D,y,v,I]),s.useEffect(()=>{const a=g.current,l=E.current;return()=>{for(const[,o]of a)o.abort();a.clear();for(const[,o]of l)URL.revokeObjectURL(o);l.clear()}},[]),s.useEffect(()=>{const a=V.current;if(!a)return;const l=()=>F.current.onBlur?.();return a.addEventListener("cancel",l),()=>a.removeEventListener("cancel",l)},[]),s.useEffect(()=>{F.current.onFilesChange?.(f.items)},[f.items]);const Ne=s.useCallback(()=>({id:z.root,"data-dragging":c||void 0,"data-disabled":e||void 0}),[z,c,e]),oe=s.useCallback(()=>{O.current=0,p(!1)},[]),De=s.useCallback(()=>{const a={id:z.dropzone,role:"button",tabIndex:e?-1:0,"aria-disabled":e||void 0,"data-dragging":c||void 0,"data-disabled":e||void 0,onClick:M,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),M())},onFocus:()=>se(!0),onBlur:()=>{se(!1),F.current.onBlur?.()}};return k&&!e&&(a.onDragEnter=l=>{l.preventDefault(),Array.from(l.dataTransfer?.types??[]).includes("Files")&&(O.current+=1,p(!0))},a.onDragOver=l=>{l.preventDefault()},a.onDragLeave=()=>{O.current=Math.max(0,O.current-1),O.current===0&&p(!1)},a.onDrop=l=>{l.preventDefault(),oe();const o=Array.from(l.dataTransfer?.files??[]);o.length>0&&L(o),F.current.onBlur?.()}),T&&!e&&(a.onPaste=l=>{const o=Array.from(l.clipboardData?.files??[]);o.length>0&&(l.preventDefault(),L(o))}),a},[z,e,c,k,T,M,L,oe]),$e=s.useCallback(()=>({type:"button",disabled:e,onClick:M}),[e,M]),ue=s.useCallback(a=>{const l=Array.from(a.target.files??[]);a.target.value="",l.length>0&&L(l),F.current.onBlur?.()},[L]),Ee=s.useCallback(()=>({ref:V,id:z.hiddenInput,type:"file",accept:n,multiple:i,capture:N,disabled:e,tabIndex:-1,"aria-hidden":!0,style:pe,onChange:ue}),[z,n,i,N,e,ue]),Le=s.useCallback(()=>({role:"list"}),[]),Me=s.useCallback(a=>({role:"listitem","data-status":a.status}),[]),Ae=s.useCallback(a=>({type:"button","aria-label":`Удалить файл ${ae(a)}`,disabled:e,onClick:()=>_(a.key)}),[e,_]),Be=s.useCallback(a=>({type:"button","aria-label":`Повторить загрузку файла ${ae(a)}`,onClick:()=>te(a.key)}),[te]),Oe=s.useCallback(()=>({type:"button",disabled:e||f.items.length===0,onClick:ee}),[e,f.items.length,ee]),Ge=s.useCallback(()=>({id:z.liveRegion,role:"status","aria-live":"polite",style:pe}),[z]),He=i?u??1/0:1,Ke=f.items.some(a=>a.status==="uploading");return{items:f.items,rejections:f.rejections,dragging:c,focused:Q,disabled:e,maxFilesReached:f.items.length>=He,uploading:Ke,liveMessage:we,ids:z,openFilePicker:M,addFiles:L,removeItem:_,clear:ee,retry:te,abort:je,focus:Se,getPreviewUrl:Te,getRootProps:Ne,getDropzoneProps:De,getTriggerProps:$e,getHiddenInputProps:Ee,getItemGroupProps:Le,getItemProps:Me,getItemDeleteTriggerProps:Ae,getItemRetryTriggerProps:Be,getClearTriggerProps:Oe,getLiveRegionProps:Ge}}const ne=s.forwardRef(function({children:t,...r},e){const n=_e(r);return s.useImperativeHandle(e,()=>({openFilePicker:n.openFilePicker,addFiles:n.addFiles,removeItem:n.removeItem,clear:n.clear,retry:n.retry,abort:n.abort,focus:n.focus}),[n]),m.jsxs(fe.Provider,{value:n,children:[m.jsx("input",{...n.getHiddenInputProps()}),t,m.jsx("div",{...n.getLiveRegionProps(),children:n.liveMessage})]})});ne.displayName="FileUpload.Root";const ke=s.forwardRef(function({asChild:t,children:r,...e},n){const{getTriggerProps:i}=S();return m.jsx(t?W:"button",{ref:n,...i(),...e,children:r})});ke.displayName="FileUpload.Trigger";const he=s.forwardRef(function({asChild:t,children:r,...e},n){const{getDropzoneProps:i}=S();return m.jsx(t?W:"div",{ref:n,...i(),...e,children:r})});he.displayName="FileUpload.Dropzone";const be=s.forwardRef(function({children:t,...r},e){const{items:n,getItemGroupProps:i}=S();return n.length===0?null:m.jsx("ul",{ref:e,...i(),...r,children:n.map(u=>t(u))})});be.displayName="FileUpload.ItemGroup";const Fe=s.forwardRef(function({item:t,children:r,...e},n){const{getItemProps:i}=S(),u=s.useMemo(()=>({item:t}),[t]);return m.jsx(ge.Provider,{value:u,children:m.jsx("li",{ref:n,...i(t),...e,children:r})})});Fe.displayName="FileUpload.Item";function et(t){return t.file?.type??t.remote?.type??""}const ve=s.forwardRef(function({children:t,alt:r,...e},n){const{getPreviewUrl:i}=S(),{item:u}=B(),k=et(u).startsWith("image/")?i(u.key):null;return k?m.jsx("img",{ref:n,src:k,alt:r??"",...e}):m.jsx(m.Fragment,{children:t})});ve.displayName="FileUpload.ItemPreview";const xe=s.forwardRef(function(t,r){const{item:e}=B(),n=e.status==="uploaded"?e.file?.name??e.remote.name:e.file.name;return m.jsx("span",{ref:r,...t,children:n})});xe.displayName="FileUpload.ItemName";const Ce=s.forwardRef(function(t,r){const{item:e}=B(),n=e.status==="uploaded"?e.file?.size??e.remote.size:e.file.size;return typeof n!="number"?null:m.jsx("span",{ref:r,...t,children:qe(n)})});Ce.displayName="FileUpload.ItemSize";const Re=s.forwardRef(function({children:t,...r},e){const{item:n}=B();if(n.status!=="uploading")return null;const i=Math.round(n.progress);return m.jsx("div",{ref:e,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,"data-progress":i,...r,children:t?t(i):`${i}%`})});Re.displayName="FileUpload.ItemProgress";const ze=s.forwardRef(function({asChild:t,children:r,...e},n){const{getItemDeleteTriggerProps:i}=S(),{item:u}=B();return m.jsx(t?W:"button",{ref:n,...i(u),...e,children:r})});ze.displayName="FileUpload.ItemDeleteTrigger";const Ue=s.forwardRef(function({asChild:t,children:r,...e},n){const{getItemRetryTriggerProps:i}=S(),{item:u}=B();return u.status!=="error"?null:m.jsx(t?W:"button",{ref:n,...i(u),...e,children:r})});Ue.displayName="FileUpload.ItemRetryTrigger";const Ie=s.forwardRef(function({asChild:t,children:r,...e},n){const{getClearTriggerProps:i}=S();return m.jsx(t?W:"button",{ref:n,...i(),...e,children:r})});Ie.displayName="FileUpload.ClearTrigger";const b=ne;b.Root=ne;b.Trigger=ke;b.Dropzone=he;b.ItemGroup=be;b.Item=Fe;b.ItemPreview=ve;b.ItemName=xe;b.ItemSize=Ce;b.ItemProgress=Re;b.ItemDeleteTrigger=ze;b.ItemRetryTrigger=Ue;b.ClearTrigger=Ie;export{b as FileUpload,Ie as FileUploadClearTrigger,fe as FileUploadContext,he as FileUploadDropzone,Fe as FileUploadItem,ge as FileUploadItemContext,ze as FileUploadItemDeleteTrigger,be as FileUploadItemGroup,xe as FileUploadItemName,ve as FileUploadItemPreview,Re as FileUploadItemProgress,Ue as FileUploadItemRetryTrigger,Ce as FileUploadItemSize,ne as FileUploadRoot,ke as FileUploadTrigger,Xe as fileItemKey,ce as fileUploadReducer,qe as formatFileSize,ye as initialFileUploadState,j as makeFileError,re as projectValue,de as reconcileItems,Je as selectFiles,_e as useFileUpload,S as useFileUploadContext,B as useFileUploadItemContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Y as l,Z as o,ep as h,a8 as p,W as g}from"../../js/index-C4LjLCAZ.js";function E(e){const{length:t,value:i,errors:a,valid:s,invalid:d}=h(e);return{items:l.useMemo(()=>e.map((n,r)=>({control:n,index:r,id:n.id??r,remove:()=>e.removeAt(r),moveUp:()=>e.move(r,r-1),moveDown:()=>e.move(r,r+1),canMoveUp:r>0,canMoveDown:r<t-1})),[e,t,i]),length:t,isEmpty:t===0,add:n=>e.push(n),clear:()=>e.clear(),insert:(n,r)=>e.insert(n,r),removeAt:n=>e.removeAt(n),move:(n,r)=>e.move(n,r),swap:(n,r)=>e.swap(n,r),at:n=>e.at(n),errors:a,valid:s,invalid:d}}const y=l.createContext(null),A=l.createContext(null);function v(){const e=l.useContext(y);if(!e)throw new Error("FormArray.* components must be used within FormArray.Root or RenderSchema FormArray");return e}function F(){const e=l.useContext(A);if(!e)throw new Error("FormArray.Item* components must be used within FormArray.List or item template");return e}function b({children:e,className:t,as:i="div"}){const{items:a,move:s}=v(),d=a.length,n=a.map(r=>{const m={...r,moveUp:()=>s(r.index,r.index-1),moveDown:()=>s(r.index,r.index+1),canMoveUp:r.index>0,canMoveDown:r.index<d-1},c=m;return o.jsx(A.Provider,{value:c,children:e(m)},r.id)});return t?l.createElement(i,{className:t},n):o.jsx(o.Fragment,{children:n})}function R({children:e,initialValue:t,asChild:i=!1,disabled:a,...s},d){const{add:n,control:r}=v(),{disabled:m}=h(r),c=a||m;return o.jsx(i?p:"button",{ref:d,type:i?void 0:"button",disabled:c,onClick:()=>{c||n(t)},...s,children:e})}const f=l.forwardRef(R);f.displayName="FormArray.AddButton";const I=f,w=l.forwardRef(({children:e,asChild:t=!1,disabled:i,...a},s)=>{const{remove:d}=F(),n=l.useContext(y),{disabled:r}=h(n?.control),m=i||r;return o.jsx(t?p:"button",{ref:s,type:t?void 0:"button",disabled:m,onClick:()=>{m||d()},...a,children:e})});w.displayName="FormArray.RemoveButton";function B({children:e}){const{isEmpty:t}=v();return t?o.jsx(o.Fragment,{children:e}):null}function N({render:e}){const{length:t}=v();return e?o.jsx(o.Fragment,{children:e(t)}):o.jsx(o.Fragment,{children:t})}function M({render:e}){const{index:t}=F();return e?o.jsx(o.Fragment,{children:e(t)}):o.jsx(o.Fragment,{children:t+1})}const j=l.forwardRef(({asChild:e=!1,multi:t=!1,render:i,children:a,...s},d)=>{const{errors:n}=v(),r=g();if(n.length===0)return null;const m=e?p:"p";return i?o.jsx(o.Fragment,{children:n.map((c,x)=>o.jsx(m,{role:"alert",...s,children:i(c,x)},c.code??x))}):t?o.jsx(o.Fragment,{children:n.map((c,x)=>o.jsx(m,{role:"alert",...s,children:r(c)},c.code??x))}):o.jsx(m,{ref:d,role:"alert",...s,children:a??r(n[0])})});j.displayName="FormArray.Error";function U({control:e,children:t},i){const a=E(e);l.useImperativeHandle(i,()=>({add:a.add,clear:a.clear,insert:a.insert,removeAt:d=>e.removeAt(d),move:a.move,swap:a.swap,length:a.length,isEmpty:a.isEmpty,at:d=>e.at(d)}),[a,e]);const s={...a,control:e};return o.jsx(y.Provider,{value:s,children:t})}const C=l.forwardRef(U),u=C;u.Root=C;u.List=b;u.AddButton=I;u.RemoveButton=w;u.Empty=B;u.Count=N;u.ItemIndex=M;u.Error=j;export{u as FormArray,I as FormArrayAddButton,y as FormArrayContext,N as FormArrayCount,B as FormArrayEmpty,j as FormArrayError,A as FormArrayItemContext,M as FormArrayItemIndex,b as FormArrayList,w as FormArrayRemoveButton,E as useFormArray,v as useFormArrayContext,F as useFormArrayItemContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{W as s}from"./define-steps-CyGUrx9p-vcI1WbRz.js";import{z,J as F,U as W,Y as f,X as u,Q as x,K as S,N as l,Z as E,f as N,a as g}from"./define-steps-CyGUrx9p-vcI1WbRz.js";import{Z as o,Y as e}from"../../js/index-C4LjLCAZ.js";import{a8 as j}from"../../js/index-C4LjLCAZ.js";function i({children:r}){return o.jsx(o.Fragment,{children:r})}i.displayName="Step";function d(r){const{currentStep:a}=s();e.useEffect(()=>{const t=r.createStepController(a);if(t)return t.start()},[r,a])}export{z as FormWizard,F as FormWizardActions,W as FormWizardContext,f as FormWizardIndicator,u as FormWizardNext,x as FormWizardPrev,S as FormWizardProgress,l as FormWizardStep,E as FormWizardSubmit,j as Slot,i as Step,N as defineSteps,s as useFormWizard,g as useFormWizardActions,d as useWizardStepValidation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as r,F as t,S as a,z as s,D as i,T as l,$ as n,H as m,k as d,I as u,B as F,j as p,K as c,a as y,b as A,P as x,C,c as g,R as I,N as U,d as R,A as B,e as f,l as z,Q as S,o as L,f as E,n as W,U as v,g as T,h as P,M as D,i as M,m as N,q as O,r as V,s as b,t as h,u as K,v as j,w as k,x as w,y as G,E as J,X as q,G as H,O as Q,J as X,L as Y,V as $,W as Z}from"../../js/index-C4LjLCAZ.js";import{FormArray as ee,FormArrayAddButton as oe,FormArrayContext as re,FormArrayCount as te,FormArrayEmpty as ae,FormArrayItemContext as se,FormArrayItemIndex as ie,FormArrayList as le,FormArrayRemoveButton as ne,useFormArray as me,useFormArrayContext as de,useFormArrayItemContext as ue}from"./form-array-DlFEb40E.js";import{List as pe,ListContext as ce,ListItemContext as ye,useList as Ae,useListContext as xe,useListItemContext as Ce}from"./list-DkqJWU70.js";import{FileUpload as Ie,FileUploadClearTrigger as Ue,FileUploadContext as Re,FileUploadDropzone as Be,FileUploadItem as fe,FileUploadItemContext as ze,FileUploadItemDeleteTrigger as Se,FileUploadItemGroup as Le,FileUploadItemName as Ee,FileUploadItemPreview as We,FileUploadItemProgress as ve,FileUploadItemRetryTrigger as Te,FileUploadItemSize as Pe,FileUploadRoot as De,FileUploadTrigger as Me,fileItemKey as Ne,fileUploadReducer as Oe,formatFileSize as Ve,initialFileUploadState as be,makeFileError as he,projectValue as Ke,reconcileItems as je,selectFiles as ke,useFileUpload as we,useFileUploadContext as Ge,useFileUploadItemContext as Je}from"./file-upload-D8FOieMN.js";import{z as He,J as Qe,U as Xe,Y as Ye,K as $e,N as Ze,f as _e,W as eo}from"./define-steps-CyGUrx9p-vcI1WbRz.js";export{r as AsyncBoundary,t as AsyncBoundaryContent,a as AsyncBoundaryContext,s as AsyncBoundaryEmpty,i as AsyncBoundaryError,l as AsyncBoundaryIdle,n as AsyncBoundaryLoading,m as AsyncBoundaryRetry,d as AsyncBoundaryRoot,u as Autocomplete,F as AutocompleteContext,p as AutocompleteInput,c as AutocompleteListbox,y as AutocompleteLoading,A as AutocompleteOption,x as AutocompleteRoot,Ie as FileUpload,Ue as FileUploadClearTrigger,Re as FileUploadContext,Be as FileUploadDropzone,fe as FileUploadItem,ze as FileUploadItemContext,Se as FileUploadItemDeleteTrigger,Le as FileUploadItemGroup,Ee as FileUploadItemName,We as FileUploadItemPreview,ve as FileUploadItemProgress,Te as FileUploadItemRetryTrigger,Pe as FileUploadItemSize,De as FileUploadRoot,Me as FileUploadTrigger,ee as FormArray,oe as FormArrayAddButton,re as FormArrayContext,te as FormArrayCount,ae as FormArrayEmpty,se as FormArrayItemContext,ie as FormArrayItemIndex,le as FormArrayList,ne as FormArrayRemoveButton,C as FormField,g as FormFieldContext,I as FormFieldControl,U as FormFieldDescription,R as FormFieldError,B as FormFieldLabel,f as FormFieldRoot,He as FormWizard,Qe as FormWizardActions,Xe as FormWizardContext,Ye as FormWizardIndicator,$e as FormWizardProgress,Ze as FormWizardStep,pe as List,ce as ListContext,ye as ListItemContext,z as ValidationMessagesProvider,S as asyncResourceReducer,L as autocompleteReducer,E as createMessageResolver,W as defaultErrorResolver,v as defaultToError,_e as defineSteps,Ne as fileItemKey,Oe as fileUploadReducer,T as filterClient,Ve as formatFileSize,P as hasMore,D as initialAsyncResourceState,M as initialAutocompleteState,be as initialFileUploadState,N as initialResourceState,O as isNearBottom,V as isSuggestionResource,he as makeFileError,b as matchSuggestions,h as mergeOptions,K as normalizeItems,j as normalizeSuggestions,Ke as projectValue,je as reconcileItems,k as resolveStrategyFlags,w as resourceReducer,ke as selectFiles,G as useAsyncBoundary,J as useAsyncBoundaryContext,q as useAsyncResource,H as useAutocomplete,Q as useAutocompleteContext,we as useFileUpload,Ge as useFileUploadContext,Je as useFileUploadItemContext,me as useFormArray,de as useFormArrayContext,ue as useFormArrayItemContext,X as useFormField,Y as useFormFieldContext,eo as useFormWizard,Ae as useList,xe as useListContext,Ce as useListItemContext,$ as useResourceOptions,Z as useValidationErrorResolver};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Y as s,Z as n,ep as h}from"../../js/index-C4LjLCAZ.js";function p(t){const{length:e,value:o}=h(t);return{items:s.useMemo(()=>t.map((i,r)=>({control:i,index:r,id:i.id??r})),[t,e,o]),length:e,isEmpty:e===0}}const a=s.createContext(null),m=s.createContext(null);function l(){const t=s.useContext(a);if(!t)throw new Error("List.* components must be used within List.Root");return t}function C(){const t=s.useContext(m);if(!t)throw new Error("List item components must be used within List.Items");return t}function d({control:t,children:e}){const o=p(t);return n.jsx(a.Provider,{value:o,children:e})}function L({children:t,className:e,as:o="div"}){const{items:i}=l(),r=i.map(c=>{const x=c;return n.jsx(m.Provider,{value:x,children:t(c)},c.id)});return e?s.createElement(o,{className:e},r):n.jsx(n.Fragment,{children:r})}function f({children:t}){const{isEmpty:e}=l();return e?n.jsx(n.Fragment,{children:t}):null}const u=d;u.Root=d;u.Items=L;u.Empty=f;export{u as List,a as ListContext,m as ListItemContext,p as useList,l as useListContext,C as useListItemContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as X,$ as ee,R as te,A as re,B as ae,k as se,D as ne,L as oe,J as ie,K as ce,I as le,b as de,T as ue}from"./loader-BK2c_fCA-
|
|
1
|
+
import{p as X,$ as ee,R as te,A as re,B as ae,k as se,D as ne,L as oe,J as ie,K as ce,I as le,b as de,T as ue}from"./loader-BK2c_fCA-BtIEWzon.js";import{d as M}from"./types-DoMH_n1U-BSN9tyeo.js";import"../../js/index-C4LjLCAZ.js";function D(r){const t=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\/:([A-Za-z_][\w]*)/g,"/(?<$1>[^/]+)").replace(/\*/g,".*");return new RegExp(`^${t}/?$`)}const S=new Map;function k(r){let t=S.get(r);return t||(t=D(r),S.set(r,t)),t}function J(r,t){switch(t.by){case"id":return r.id===t.id&&(t.version===void 0||r.version===t.version);case"slot":return r.placement?.slots?.includes(t.slot)??!1;case"route":return r.placement?.routes?.some(n=>k(n).test(t.path))??!1;case"tag":return r.meta?.tags?.includes(t.tag)??!1}}function z(r,t){const n=r.access;return n?n.permissions?.some(s=>!t.permissions.has(s))||n.flags?.some(s=>!t.flags.has(s))?!1:n.canRender?n.canRender(t):!0:!0}function H(r,t){const n=r.split(/[.\-+]/),s=t.split(/[.\-+]/);for(let h=0;h<Math.max(n.length,s.length);h++){const w=n[h]??"",l=s[h]??"",p=Number(w),a=Number(l),i=!Number.isNaN(p)&&!Number.isNaN(a)&&w!==""&&l!==""?a-p:l.localeCompare(w);if(i!==0)return i}return 0}function O(r,t){const n=r.placement?.priority??0,s=t.placement?.priority??0;return n!==s?s-n:H(r.version,t.version)}function T(r,t,n){return r.filter(s=>J(s,t)).filter(s=>z(s,n)).sort(O)}function j(r,t){for(const n of r.placement?.routes??[]){const s=k(n).exec(t);if(s)return{...s.groups}}}const K=Symbol.for("reformer.form-registry.v1");function C(){const r=globalThis;return r[K]??={}}const W=r=>`${r.id}@${r.version}`;function I(){const r=new Map,t=new Set,n=[];let s=[],h=!0;const w=()=>(h&&(s=[...r.values()],h=!1),s),l=()=>{h=!0,t.forEach(a=>a())},p=(a,i)=>{const u=W(a),g=r.get(u),b=i?.onConflict??"throw";if(g&&g!==a){if(b==="keep")return n.push({level:"warn",code:"duplicate-entry-kept",message:`Форма ${u} уже зарегистрирована владельцем "${g.owner}"; регистрация от "${a.owner}" проигнорирована.`,entry:{id:a.id,version:a.version,owner:a.owner}}),()=>{};if(b==="throw")throw new Error(`Конфликт в реестре форм: ${u} уже зарегистрирована владельцем "${g.owner}", повторная регистрация от "${a.owner}". Разведите id по владельцам или передайте { onConflict: 'replace' | 'keep' }, если перекрытие намеренное.`);n.push({level:"warn",code:"duplicate-entry-replaced",message:`Форма ${u} от "${g.owner}" заменена регистрацией от "${a.owner}".`,entry:{id:a.id,version:a.version,owner:a.owner}})}r.set(u,a),l();let $=!1;return()=>{$||($=!0,r.get(u)===a&&(r.delete(u),l()))}};return{register:p,registerAll(a,i){const u=a.map(g=>p(g,i));return()=>u.forEach(g=>g())},list:w,resolve:(a,i)=>T(w(),a,i),subscribe(a){return t.add(a),()=>t.delete(a)},get diagnostics(){return n}}}function B(){const r=C();return r.instance??=I()}function G(){C().instance=void 0}const U={"l1-hit":"l1Hit","l2-hit":"l2Hit",dedup:"dedup",stale:"stale",miss:"miss",fetched:"fetched",refetched:"refetched",revalidated:"revalidated",error:"error",aborted:"aborted"},V={"cache-read-failed":"l2ReadFailed","cache-write-failed":"l2WriteFailed","cache-corrupt":"l2Corrupt"},L=()=>({l1Hit:0,l2Hit:0,dedup:0,stale:0,miss:0,fetched:0,refetched:0,revalidated:0,error:0,aborted:0,l2ReadFailed:0,l2WriteFailed:0,l2Corrupt:0,bytesFromNetwork:0});function Q(r={}){const{storage:t,maxAgeMs:n=300*1e3,now:s=Date.now,onDiagnostic:h,onEvent:w}=r,l=new Map,p=new Map;let a=L();const i=(e,o,c)=>{a[U[e]]++,c?.bytes!==void 0&&(a.bytesFromNetwork+=c.bytes),w?.({type:e,key:o,...c})},u=(e,o,c)=>{a[V[e]]++,h?.({code:e,key:o,message:c})},g=async e=>{if(t)try{return await t.get(e)}catch(o){u("cache-read-failed",e,`L2 недоступен: ${String(o)}`);return}},b=async(e,o,c,f)=>{if(!t)return;const d=s();try{await t.set({key:e,body:o,etag:c,size:f??M(o),storedAt:d,lastUsedAt:d})}catch(F){u("cache-write-failed",e,`не записалось в L2: ${String(F)}`)}};function $(e,o,c){const f=l.get(e);if(f&&s()-f.storedAt<n)return i("l1-hit",e),Promise.resolve(f.entry.value);const d=p.get(e);return d?(i("dedup",e),x(e,d,c)):P(e,o,c)}function P(e,o,c){const f=new AbortController,d={waiters:1,controller:f,promise:void 0};p.set(e,d),d.promise=(async()=>{const y=await g(e);let m;if(y){try{m={value:JSON.parse(y.body),etag:y.etag}}catch{u("cache-corrupt",e,"тело в L2 не разобралось, запись отброшена"),await t?.delete(e).catch(()=>{})}if(m&&s()-y.storedAt<n)return i("l2-hit",e),l.set(e,{entry:m,storedAt:y.storedAt}),m}i(m?"stale":"miss",e);const E=s();try{const v=await o(m?.etag,f.signal);if(v.notModified){if(!m)throw new Error(`[form-registry] ${e}: сервер ответил 304, но кэшированного тела нет`);return i("revalidated",e,{durationMs:s()-E}),l.set(e,{entry:m,storedAt:s()}),await b(e,JSON.stringify(m.value),m.etag),m}const A={value:v.data,etag:v.etag},N=JSON.stringify(v.data),R=M(N);return i(m?"refetched":"fetched",e,{durationMs:s()-E,bytes:R}),l.set(e,{entry:A,storedAt:s()}),await b(e,N,v.etag,R),A}catch(v){throw i(f.signal.aborted?"aborted":"error",e,{durationMs:s()-E}),v}})();const F=()=>{d.waiters--,d.waiters<=0&&f.abort()};return c?.addEventListener("abort",F,{once:!0}),d.promise.finally(()=>{c?.removeEventListener("abort",F),p.get(e)===d&&p.delete(e)}).then(y=>y.value)}function x(e,o,c){o.waiters++;const f=()=>{o.waiters--,o.waiters<=0&&o.controller.abort()};return c?.addEventListener("abort",f,{once:!0}),o.promise.then(d=>d.value).finally(()=>c?.removeEventListener("abort",f))}return{get:$,async invalidate(e){l.delete(e),await t?.delete(e).catch(()=>{})},async clear(){l.clear(),await t?.clear().catch(()=>{})},get memorySize(){return l.size},stats:()=>({...a}),resetStats(){a=L()}}}export{X as FormFetchError,ee as FormLoadError,te as FormPreflightError,re as assertFormSchemaShape,O as byPriorityThenVersionDesc,ae as collectModelPaths,D as compileRoute,I as createFormRegistry,Q as createSchemaCache,se as entryKeyOf,ne as fetchJson,oe as formatPreflight,B as getFormRegistry,ie as hasPath,ce as loadForm,j as matchRouteParams,z as passesGate,le as preflight,G as resetFormRegistry,T as resolveForms,de as retryDelay,ue as satisfiesRange};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a3 as x,a4 as S,a5 as N,a6 as M,a7 as A}from"../../js/index-C4LjLCAZ.js";class g extends Error{constructor(n,t,r,o,i){super(`[form-registry] ${t}: ${r}`),this.kind=n,this.url=t,this.status=o,this.cause=i,this.name="FormFetchError"}}const E=new Set([408,425,429,500,502,503,504]),F=e=>new Promise(n=>setTimeout(n,e));function $(e,n,t,r){if(r){const i=Number(r);if(Number.isFinite(i)&&i>=0)return i*1e3;const a=Date.parse(r);if(!Number.isNaN(a))return Math.max(0,a-Date.now())}const o=n*2**e;return Math.round(o*(.5+t()*.5))}const O=e=>!e||/\bjson\b/i.test(e);async function P(e,n={}){const{init:t,signal:r,etag:o,retries:i=2,retryBaseMs:a=250,fetchImpl:f=fetch,sleep:s=F,random:l=Math.random}=n,u=new Headers(t?.headers);u.has("accept")||u.set("accept","application/json"),o&&u.set("if-none-match",o);let w;for(let h=0;h<=i;h++){if(r?.aborted)throw new g("aborted",e,"запрос отменён");let c;try{c=await f(e,{...t,headers:u,signal:r})}catch(d){if(r?.aborted)throw new g("aborted",e,"запрос отменён",void 0,d);if(w=d,h===i)throw new g("network",e,"сеть недоступна",void 0,d);await s($(h,a,l));continue}if(c.status===304)return{data:void 0,etag:o,notModified:!0};if(!c.ok){if(E.has(c.status)&&h<i){await s($(h,a,l,c.headers.get("retry-after")));continue}throw new g("http-error",e,`HTTP ${c.status}`,c.status)}const p=c.headers.get("content-type");if(!O(p))throw new g("not-json",e,`ожидался JSON, получен content-type "${p}" — похоже на SPA-fallback (index.html)`,c.status);let m;try{m=await c.text()}catch(d){throw new g("network",e,"тело ответа не дочиталось",c.status,d)}try{return{data:JSON.parse(m),etag:c.headers.get("etag")??void 0,notModified:!1}}catch(d){throw new g("not-json",e,"тело не разобралось как JSON",c.status,d)}}throw new g("network",e,"исчерпаны попытки",void 0,w)}function B(e,n){if(!n||typeof n!="object"||Array.isArray(n))throw new g("not-a-form-schema",e,"ожидался объект схемы");if(!("root"in n))throw new g("not-a-form-schema",e,"в объекте нет обязательного поля `root` — это не схема формы")}function D(e,n){const t=n.trim();if(!t||t==="*"||t==="x")return!0;const r=l=>l.replace(/^[v=]+/,"").split(/[.\-+]/).slice(0,3).map(u=>u==="x"||u==="*"?-1:Number(u)).map(u=>Number.isFinite(u)?u:-1),o=(l,u)=>{for(let w=0;w<3;w++){const h=l[w]??0,c=u[w]??0;if(h!==c)return h<c?-1:1}return 0},i=r(e),a=/^(>=|<=|>|<|\^|~)?\s*(.+)$/.exec(t),f=a?.[1]??"",s=r(a?.[2]??t);if(s.includes(-1)){for(let l=0;l<3;l++){if(s[l]===-1)return!0;if((i[l]??0)!==s[l])return!1}return!0}switch(f){case">=":return o(i,s)>=0;case">":return o(i,s)>0;case"<=":return o(i,s)<=0;case"<":return o(i,s)<0;case"^":return s[0]>0?i[0]===s[0]&&o(i,s)>=0:s[1]>0?i[0]===0&&i[1]===s[1]&&o(i,s)>=0:o(i,s)===0;case"~":return i[0]===s[0]&&i[1]===s[1]&&o(i,s)>=0;default:return o(i,s)===0}}function I(e){const n=new Set,t=r=>{if(typeof r=="string"){const o=/^\$model\(([^)]*)\)$/.exec(r);o?.[1]&&n.add(o[1]);return}if(Array.isArray(r)){r.forEach(t);return}if(r&&typeof r=="object")for(const o of Object.values(r))t(o)};return t(e.root),[...n]}function J(e,n){if(/(^|\.)\d+(\.|$)/.test(n))return!0;let t=e;for(const r of n.split(".")){if(t===null||typeof t!="object"||!(r in t))return!1;t=t[r]}return!0}function K(e){const{entry:n,schema:t,registry:r,initial:o,validation:i}=e,a=[],f=t;n.compatibleSchema&&f.version&&!D(f.version,n.compatibleSchema)&&a.push({code:"schema-version-drift",level:"error",items:[f.version],message:`схема версии ${f.version} вне диапазона "${n.compatibleSchema}", объявленного кодом. Похоже, схему выкатили вперёд кода — обновите микрофронт либо откатите схему.`});const s=[];f.id&&f.id!==n.id&&s.push(`id: ждали "${n.id}", получили "${f.id}"`),s.length&&a.push({code:"schema-identity-mismatch",level:"error",items:s,message:`схема не соответствует записи (${s.join("; ")})`});const l=S(t),u=l.components.filter(m=>!r.has(m));u.length&&a.push({code:"missing-components",level:"error",items:u,message:`в реестре нет компонентов: ${u.join(", ")}`});const w=new Set(N(r)),h=l.dataSources.filter(m=>!w.has(m));h.length&&a.push({code:"missing-data-sources",level:"error",items:h,message:`в реестре нет источников данных: ${h.join(", ")}`});const c=new Set(M(r)),p=l.fns.filter(m=>!c.has(m));if(p.length&&a.push({code:"missing-fns",level:"error",items:p,message:`в реестре нет функций: ${p.join(", ")}`}),i?.steps){const m=A(t),d=Object.keys(i.steps).filter(k=>!m.has(k));d.length&&a.push({code:"unknown-step-selectors",level:"error",items:d,message:`валидация ссылается на несуществующие шаги: ${d.join(", ")}. Известные селекторы: ${[...m].sort().join(", ")||"(нет)"}. Переименованный шаг иначе просто перестал бы валидироваться — молча.`})}if(o!=null){const m=I(t).filter(d=>!J(o,d));m.length&&a.push({code:"unmaterialized-model-paths",level:"warn",items:m,message:`в начальных значениях нет полей: ${m.join(", ")}. У таких полей нет сигнала, поэтому ни поведение, ни ошибки валидации к ним не привяжутся — и это не проявится ничем, кроме «валидация не работает».`})}return{ok:!a.some(m=>m.level==="error"),problems:a}}function T(e,n){return n.problems.length?[`Форма ${e} не прошла проверку:`,...n.problems.map(t=>` • [${t.level}] ${t.message}`)].join(`
|
|
2
|
+
`):`${e}: проверки пройдены`}class v extends Error{constructor(n,t,r,o){super(`[form-registry] ${n}: ${t} — ${r}`),this.entryKey=n,this.part=t,this.cause=o,this.name="FormLoadError"}}class H extends Error{constructor(n,t){super(T(n,t)),this.entryKey=n,this.result=t,this.name="FormPreflightError"}}const j=e=>`${e.id}@${e.version}`,R=(e,n)=>`${e.owner}/${e.id}@${e.version}#${n}`;async function b(e,n,t,r){if(!e)return;const o=j(n);if(e.kind==="inline")return e.value;if(e.kind==="module")try{return await e.load()}catch(a){throw new v(o,t,"модуль не загрузился",a)}const i=async(a,f)=>{const s=await P(e.url,{init:e.init,signal:f,etag:a,fetchImpl:r.fetchImpl});return!s.notModified&&t==="schema"&&B(e.url,s.data),s};try{return r.cache?await r.cache.get(R(n,t),i,r.signal):(await i(void 0,r.signal??new AbortController().signal)).data}catch(a){throw new v(o,t,`не загрузилось по сети (${e.url})`,a)}}async function y(e,n,t){if(e){if(e.kind==="inline")return e.value;try{return await e.load()}catch(r){throw new v(n,t,"модуль не загрузился",r)}}}async function C(e,n,t={}){const r=j(e),[o,i,a,f,s,l,u]=await Promise.all([b(e.schema,e,"schema",t),y(e.registry,r,"registry"),b(e.initial,e,"initial",t),y(e.model,r,"model"),y(e.behavior,r,"behavior"),y(e.validation,r,"validation"),y(e.renderBehavior,r,"renderBehavior")]);if(!o)throw new v(r,"schema","схема не загрузилась");if(!a&&!f)throw new v(r,"model","нужны либо `initial` (начальные значения), либо `model` (фабрика модели)");const w=i?x(n,i):n;let h;const c=t.preflight??"error";if(c!=="off"){h=K({entry:e,schema:o,registry:w,initial:a,validation:l});for(const p of h.problems)t.onDiagnostic?.({code:p.code,message:p.message,entryKey:r,level:p.level});if(!h.ok&&c==="error")throw new H(r,h)}return{schema:o,registry:w,initial:a,makeModel:f,behavior:s,validation:l,makeRenderBehavior:u,preflight:h}}export{v as $,B as A,I as B,P as D,K as I,J,C as K,T as L,H as R,D as T,$ as b,j as k,g as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Y as a,Z as m,_ as F,a0 as k,a1 as j,a2 as E}from"../../js/index-C4LjLCAZ.js";import{k as v,K as M}from"./loader-BK2c_fCA-BtIEWzon.js";const x=a.createContext(null);function I({registry:r,context:e,baseRegistry:s,cache:t,options:i,children:n}){const o=a.useSyncExternalStore(r.subscribe,r.list,r.list),{onDiagnostic:c,preflight:l,fetchImpl:d}=i??{},y=a.useMemo(()=>({registry:r,entries:o,ctx:e,baseRegistry:s,cache:t,options:{onDiagnostic:c,preflight:l,fetchImpl:d}}),[r,o,e,s,t,c,l,d]);return m.jsx(x.Provider,{value:y,children:n})}function p(){const r=a.useContext(x);if(!r)throw new Error("[form-registry] Компонент использован вне <FormRegistryProvider>. Оберните поддерево провайдером с registry, context и baseRegistry.");return r}function S(r,e,s){const[t,i]=a.useState({status:"pending"}),[n,o]=a.useState(0),c=a.useCallback(()=>o(f=>f+1),[]),l=v(r),d=a.useRef(r);d.current=r;const y=a.useRef(s);y.current=s;const h=s?.cache;return a.useEffect(()=>{let f=!1;return i({status:"pending"}),M(d.current,e,y.current).then(u=>{f||i({status:"ready",data:u})},u=>{f||i({status:"error",error:u instanceof Error?u:new Error(String(u))})}),()=>{f=!0}},[l,e,h,n]),t.status==="ready"&&t.data?{status:"ready",data:t.data}:t.status==="error"&&t.error?{status:"error",error:t.error,retry:c}:{status:"pending"}}function w({entry:r,loaded:e,initial:s,model:t,renderBehaviorOptions:i,errorFallback:n,onReady:o}){const c=F(()=>k({schema:e.schema,registry:e.registry,...t?{model:t}:e.makeModel?{model:e.makeModel()}:{initial:s??e.initial},behavior:e.behavior,...e.validation?{validation:e.validation}:{},...e.makeRenderBehavior?{renderBehavior:(l,d,y)=>e.makeRenderBehavior(l,d,y,i)}:{}}));return a.useEffect(()=>{o?.(c)},[c,o]),m.jsx(j,{resetKey:c,fallback:n?l=>n(l,r):void 0,children:m.jsx(E,{form:c,registry:e.registry,validateSchema:!1})})}function b({entry:r,...e}){const{baseRegistry:s,cache:t,options:i}=p(),{onDiagnostic:n,preflight:o,fetchImpl:c}=i,{id:l,version:d,owner:y}=r,h=a.useCallback(g=>n?.({level:g.level??"warn",code:g.code,message:g.message,entry:{id:l,version:d,owner:y}}),[n,l,d,y]),f=a.useMemo(()=>({cache:t,preflight:o,fetchImpl:c,onDiagnostic:n?h:void 0}),[t,o,c,n,h]),u=S(r,s,f);return u.status==="pending"?e.fallback??null:u.status==="error"?e.loadErrorFallback?.(u.error,u.retry)??null:m.jsx(w,{entry:r,loaded:u.data,initial:e.initial,model:e.model,renderBehaviorOptions:e.renderBehaviorOptions,errorFallback:e.errorFallback,onReady:e.onReady})}function D({id:r,version:e,...s}){const{entries:t,ctx:i,registry:n}=p(),o=a.useMemo(()=>n.resolve({by:"id",id:r,version:e},i)[0],[n,t,r,e,i]);return o?m.jsx(b,{entry:o,...s},v(o)):null}function R({query:r,...e}){const{entries:s,ctx:t,registry:i}=p(),n=a.useMemo(()=>i.resolve(r,t),[i,s,r,t]);return m.jsx(m.Fragment,{children:n.map(o=>m.jsx(b,{entry:o,...e},v(o)))})}function K({name:r,...e}){const s=a.useMemo(()=>({by:"slot",slot:r}),[r]);return m.jsx(R,{query:s,...e})}function O({path:r,...e}){const s=a.useMemo(()=>({by:"route",path:r}),[r]);return m.jsx(R,{query:s,...e})}export{D as FormOutlet,I as FormRegistryProvider,O as FormRoute,K as FormSlot,w as MountedForm,p as useFormRegistryContext,S as useFormResource};
|
package/dist/assets/vendor/reformer-renderer-json/{validate-C5Gll2Yt.js → validate-DXzHWMfT.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as hs,a as ps,b as ms,W as ys,q as vs,s as Ct,t as gs,L as ss,v as $s}from"../../js/index-BSeq6-8S.js";function ws(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _t={exports:{}},Rt={},he={},$e={},Dt={},Vt={},At={},zt;function ft(){return zt||(zt=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class r{}e._CodeOrName=r,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class p extends r{constructor(s){if(super(),!e.IDENTIFIER.test(s))throw new Error("CodeGen: name must be a valid identifier");this.str=s}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=p;class n extends r{constructor(s){super(),this._items=typeof s=="string"?[s]:s}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const s=this._items[0];return s===""||s==='""'}get str(){var s;return(s=this._str)!==null&&s!==void 0?s:this._str=this._items.reduce((t,g)=>`${t}${g}`,"")}get names(){var s;return(s=this._names)!==null&&s!==void 0?s:this._names=this._items.reduce((t,g)=>(g instanceof p&&(t[g.str]=(t[g.str]||0)+1),t),{})}}e._Code=n,e.nil=new n("");function o(a,...s){const t=[a[0]];let g=0;for(;g<s.length;)f(t,s[g]),t.push(a[++g]);return new n(t)}e._=o;const u=new n("+");function d(a,...s){const t=[h(a[0])];let g=0;for(;g<s.length;)t.push(u),f(t,s[g]),t.push(u,h(a[++g]));return m(t),new n(t)}e.str=d;function f(a,s){s instanceof n?a.push(...s._items):s instanceof p?a.push(s):a.push(k(s))}e.addCodeArg=f;function m(a){let s=1;for(;s<a.length-1;){if(a[s]===u){const t=w(a[s-1],a[s+1]);if(t!==void 0){a.splice(s-1,3,t);continue}a[s++]="+"}s++}}function w(a,s){if(s==='""')return a;if(a==='""')return s;if(typeof a=="string")return s instanceof p||a[a.length-1]!=='"'?void 0:typeof s!="string"?`${a.slice(0,-1)}${s}"`:s[0]==='"'?a.slice(0,-1)+s.slice(1):void 0;if(typeof s=="string"&&s[0]==='"'&&!(a instanceof p))return`"${a}${s.slice(1)}`}function $(a,s){return s.emptyStr()?a:a.emptyStr()?s:d`${a}${s}`}e.strConcat=$;function k(a){return typeof a=="number"||typeof a=="boolean"||a===null?a:h(Array.isArray(a)?a.join(","):a)}function _(a){return new n(h(a))}e.stringify=_;function h(a){return JSON.stringify(a).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=h;function v(a){return typeof a=="string"&&e.IDENTIFIER.test(a)?new n(`.${a}`):o`[${a}]`}e.getProperty=v;function E(a){if(typeof a=="string"&&e.IDENTIFIER.test(a))return new n(`${a}`);throw new Error(`CodeGen: invalid export name: ${a}, use explicit $id name mapping`)}e.getEsmExportName=E;function i(a){return new n(a.toString())}e.regexpCode=i})(At)),At}var Ut={},Kt;function qt(){return Kt||(Kt=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const r=ft();class p extends Error{constructor(w){super(`CodeGen: "code" for ${w} not defined`),this.value=w.value}}var n;(function(m){m[m.Started=0]="Started",m[m.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};class o{constructor({prefixes:w,parent:$}={}){this._names={},this._prefixes=w,this._parent=$}toName(w){return w instanceof r.Name?w:this.name(w)}name(w){return new r.Name(this._newName(w))}_newName(w){const $=this._names[w]||this._nameGroup(w);return`${w}${$.index++}`}_nameGroup(w){var $,k;if(!((k=($=this._parent)===null||$===void 0?void 0:$._prefixes)===null||k===void 0)&&k.has(w)||this._prefixes&&!this._prefixes.has(w))throw new Error(`CodeGen: prefix "${w}" is not allowed in this scope`);return this._names[w]={prefix:w,index:0}}}e.Scope=o;class u extends r.Name{constructor(w,$){super($),this.prefix=w}setValue(w,{property:$,itemIndex:k}){this.value=w,this.scopePath=(0,r._)`.${new r.Name($)}[${k}]`}}e.ValueScopeName=u;const d=(0,r._)`\n`;class f extends o{constructor(w){super(w),this._values={},this._scope=w.scope,this.opts={...w,_n:w.lines?d:r.nil}}get(){return this._scope}name(w){return new u(w,this._newName(w))}value(w,$){var k;if($.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const _=this.toName(w),{prefix:h}=_,v=(k=$.key)!==null&&k!==void 0?k:$.ref;let E=this._values[h];if(E){const s=E.get(v);if(s)return s}else E=this._values[h]=new Map;E.set(v,_);const i=this._scope[h]||(this._scope[h]=[]),a=i.length;return i[a]=$.ref,_.setValue($,{property:h,itemIndex:a}),_}getValue(w,$){const k=this._values[w];if(k)return k.get($)}scopeRefs(w,$=this._values){return this._reduceValues($,k=>{if(k.scopePath===void 0)throw new Error(`CodeGen: name "${k}" has no value`);return(0,r._)`${w}${k.scopePath}`})}scopeCode(w=this._values,$,k){return this._reduceValues(w,_=>{if(_.value===void 0)throw new Error(`CodeGen: name "${_}" has no value`);return _.value.code},$,k)}_reduceValues(w,$,k={},_){let h=r.nil;for(const v in w){const E=w[v];if(!E)continue;const i=k[v]=k[v]||new Map;E.forEach(a=>{if(i.has(a))return;i.set(a,n.Started);let s=$(a);if(s){const t=this.opts.es5?e.varKinds.var:e.varKinds.const;h=(0,r._)`${h}${t} ${a} = ${s};${this.opts._n}`}else if(s=_?.(a))h=(0,r._)`${h}${s}${this.opts._n}`;else throw new p(a);i.set(a,n.Completed)})}return h}}e.ValueScope=f})(Ut)),Ut}var Ft;function H(){return Ft||(Ft=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const r=ft(),p=qt();var n=ft();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=qt();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};class u{optimizeNodes(){return this}optimizeNames(c,P){return this}}class d extends u{constructor(c,P,x){super(),this.varKind=c,this.name=P,this.rhs=x}render({es5:c,_n:P}){const x=c?p.varKinds.var:this.varKind,A=this.rhs===void 0?"":` = ${this.rhs}`;return`${x} ${this.name}${A};`+P}optimizeNames(c,P){if(c[this.name.str])return this.rhs&&(this.rhs=W(this.rhs,c,P)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}}class f extends u{constructor(c,P,x){super(),this.lhs=c,this.rhs=P,this.sideEffects=x}render({_n:c}){return`${this.lhs} = ${this.rhs};`+c}optimizeNames(c,P){if(!(this.lhs instanceof r.Name&&!c[this.lhs.str]&&!this.sideEffects))return this.rhs=W(this.rhs,c,P),this}get names(){const c=this.lhs instanceof r.Name?{}:{...this.lhs.names};return L(c,this.rhs)}}class m extends f{constructor(c,P,x,A){super(c,x,A),this.op=P}render({_n:c}){return`${this.lhs} ${this.op}= ${this.rhs};`+c}}class w extends u{constructor(c){super(),this.label=c,this.names={}}render({_n:c}){return`${this.label}:`+c}}class $ extends u{constructor(c){super(),this.label=c,this.names={}}render({_n:c}){return`break${this.label?` ${this.label}`:""};`+c}}class k extends u{constructor(c){super(),this.error=c}render({_n:c}){return`throw ${this.error};`+c}get names(){return this.error.names}}class _ extends u{constructor(c){super(),this.code=c}render({_n:c}){return`${this.code};`+c}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(c,P){return this.code=W(this.code,c,P),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}}class h extends u{constructor(c=[]){super(),this.nodes=c}render(c){return this.nodes.reduce((P,x)=>P+x.render(c),"")}optimizeNodes(){const{nodes:c}=this;let P=c.length;for(;P--;){const x=c[P].optimizeNodes();Array.isArray(x)?c.splice(P,1,...x):x?c[P]=x:c.splice(P,1)}return c.length>0?this:void 0}optimizeNames(c,P){const{nodes:x}=this;let A=x.length;for(;A--;){const K=x[A];K.optimizeNames(c,P)||(se(c,K.names),x.splice(A,1))}return x.length>0?this:void 0}get names(){return this.nodes.reduce((c,P)=>F(c,P.names),{})}}class v extends h{render(c){return"{"+c._n+super.render(c)+"}"+c._n}}class E extends h{}class i extends v{}i.kind="else";class a extends v{constructor(c,P){super(P),this.condition=c}render(c){let P=`if(${this.condition})`+super.render(c);return this.else&&(P+="else "+this.else.render(c)),P}optimizeNodes(){super.optimizeNodes();const c=this.condition;if(c===!0)return this.nodes;let P=this.else;if(P){const x=P.optimizeNodes();P=this.else=Array.isArray(x)?new i(x):x}if(P)return c===!1?P instanceof a?P:P.nodes:this.nodes.length?this:new a(de(c),P instanceof a?[P]:P.nodes);if(!(c===!1||!this.nodes.length))return this}optimizeNames(c,P){var x;if(this.else=(x=this.else)===null||x===void 0?void 0:x.optimizeNames(c,P),!!(super.optimizeNames(c,P)||this.else))return this.condition=W(this.condition,c,P),this}get names(){const c=super.names;return L(c,this.condition),this.else&&F(c,this.else.names),c}}a.kind="if";class s extends v{}s.kind="for";class t extends s{constructor(c){super(),this.iteration=c}render(c){return`for(${this.iteration})`+super.render(c)}optimizeNames(c,P){if(super.optimizeNames(c,P))return this.iteration=W(this.iteration,c,P),this}get names(){return F(super.names,this.iteration.names)}}class g extends s{constructor(c,P,x,A){super(),this.varKind=c,this.name=P,this.from=x,this.to=A}render(c){const P=c.es5?p.varKinds.var:this.varKind,{name:x,from:A,to:K}=this;return`for(${P} ${x}=${A}; ${x}<${K}; ${x}++)`+super.render(c)}get names(){const c=L(super.names,this.from);return L(c,this.to)}}class l extends s{constructor(c,P,x,A){super(),this.loop=c,this.varKind=P,this.name=x,this.iterable=A}render(c){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(c)}optimizeNames(c,P){if(super.optimizeNames(c,P))return this.iterable=W(this.iterable,c,P),this}get names(){return F(super.names,this.iterable.names)}}class y extends v{constructor(c,P,x){super(),this.name=c,this.args=P,this.async=x}render(c){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(c)}}y.kind="func";class b extends h{render(c){return"return "+super.render(c)}}b.kind="return";class N extends v{render(c){let P="try"+super.render(c);return this.catch&&(P+=this.catch.render(c)),this.finally&&(P+=this.finally.render(c)),P}optimizeNodes(){var c,P;return super.optimizeNodes(),(c=this.catch)===null||c===void 0||c.optimizeNodes(),(P=this.finally)===null||P===void 0||P.optimizeNodes(),this}optimizeNames(c,P){var x,A;return super.optimizeNames(c,P),(x=this.catch)===null||x===void 0||x.optimizeNames(c,P),(A=this.finally)===null||A===void 0||A.optimizeNames(c,P),this}get names(){const c=super.names;return this.catch&&F(c,this.catch.names),this.finally&&F(c,this.finally.names),c}}class M extends v{constructor(c){super(),this.error=c}render(c){return`catch(${this.error})`+super.render(c)}}M.kind="catch";class V extends v{render(c){return"finally"+super.render(c)}}V.kind="finally";class z{constructor(c,P={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...P,_n:P.lines?`
|
|
1
|
+
import{ah as hs,a5 as ps,a6 as ms,ai as ys,aj as vs,ak as Ct,al as gs,am as ss,an as $s}from"../../js/index-C4LjLCAZ.js";function ws(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _t={exports:{}},Rt={},he={},$e={},Dt={},Vt={},At={},zt;function ft(){return zt||(zt=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class r{}e._CodeOrName=r,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class p extends r{constructor(s){if(super(),!e.IDENTIFIER.test(s))throw new Error("CodeGen: name must be a valid identifier");this.str=s}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=p;class n extends r{constructor(s){super(),this._items=typeof s=="string"?[s]:s}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const s=this._items[0];return s===""||s==='""'}get str(){var s;return(s=this._str)!==null&&s!==void 0?s:this._str=this._items.reduce((t,g)=>`${t}${g}`,"")}get names(){var s;return(s=this._names)!==null&&s!==void 0?s:this._names=this._items.reduce((t,g)=>(g instanceof p&&(t[g.str]=(t[g.str]||0)+1),t),{})}}e._Code=n,e.nil=new n("");function o(a,...s){const t=[a[0]];let g=0;for(;g<s.length;)f(t,s[g]),t.push(a[++g]);return new n(t)}e._=o;const u=new n("+");function d(a,...s){const t=[h(a[0])];let g=0;for(;g<s.length;)t.push(u),f(t,s[g]),t.push(u,h(a[++g]));return m(t),new n(t)}e.str=d;function f(a,s){s instanceof n?a.push(...s._items):s instanceof p?a.push(s):a.push(k(s))}e.addCodeArg=f;function m(a){let s=1;for(;s<a.length-1;){if(a[s]===u){const t=w(a[s-1],a[s+1]);if(t!==void 0){a.splice(s-1,3,t);continue}a[s++]="+"}s++}}function w(a,s){if(s==='""')return a;if(a==='""')return s;if(typeof a=="string")return s instanceof p||a[a.length-1]!=='"'?void 0:typeof s!="string"?`${a.slice(0,-1)}${s}"`:s[0]==='"'?a.slice(0,-1)+s.slice(1):void 0;if(typeof s=="string"&&s[0]==='"'&&!(a instanceof p))return`"${a}${s.slice(1)}`}function $(a,s){return s.emptyStr()?a:a.emptyStr()?s:d`${a}${s}`}e.strConcat=$;function k(a){return typeof a=="number"||typeof a=="boolean"||a===null?a:h(Array.isArray(a)?a.join(","):a)}function _(a){return new n(h(a))}e.stringify=_;function h(a){return JSON.stringify(a).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=h;function v(a){return typeof a=="string"&&e.IDENTIFIER.test(a)?new n(`.${a}`):o`[${a}]`}e.getProperty=v;function E(a){if(typeof a=="string"&&e.IDENTIFIER.test(a))return new n(`${a}`);throw new Error(`CodeGen: invalid export name: ${a}, use explicit $id name mapping`)}e.getEsmExportName=E;function i(a){return new n(a.toString())}e.regexpCode=i})(At)),At}var Ut={},Kt;function qt(){return Kt||(Kt=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const r=ft();class p extends Error{constructor(w){super(`CodeGen: "code" for ${w} not defined`),this.value=w.value}}var n;(function(m){m[m.Started=0]="Started",m[m.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};class o{constructor({prefixes:w,parent:$}={}){this._names={},this._prefixes=w,this._parent=$}toName(w){return w instanceof r.Name?w:this.name(w)}name(w){return new r.Name(this._newName(w))}_newName(w){const $=this._names[w]||this._nameGroup(w);return`${w}${$.index++}`}_nameGroup(w){var $,k;if(!((k=($=this._parent)===null||$===void 0?void 0:$._prefixes)===null||k===void 0)&&k.has(w)||this._prefixes&&!this._prefixes.has(w))throw new Error(`CodeGen: prefix "${w}" is not allowed in this scope`);return this._names[w]={prefix:w,index:0}}}e.Scope=o;class u extends r.Name{constructor(w,$){super($),this.prefix=w}setValue(w,{property:$,itemIndex:k}){this.value=w,this.scopePath=(0,r._)`.${new r.Name($)}[${k}]`}}e.ValueScopeName=u;const d=(0,r._)`\n`;class f extends o{constructor(w){super(w),this._values={},this._scope=w.scope,this.opts={...w,_n:w.lines?d:r.nil}}get(){return this._scope}name(w){return new u(w,this._newName(w))}value(w,$){var k;if($.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const _=this.toName(w),{prefix:h}=_,v=(k=$.key)!==null&&k!==void 0?k:$.ref;let E=this._values[h];if(E){const s=E.get(v);if(s)return s}else E=this._values[h]=new Map;E.set(v,_);const i=this._scope[h]||(this._scope[h]=[]),a=i.length;return i[a]=$.ref,_.setValue($,{property:h,itemIndex:a}),_}getValue(w,$){const k=this._values[w];if(k)return k.get($)}scopeRefs(w,$=this._values){return this._reduceValues($,k=>{if(k.scopePath===void 0)throw new Error(`CodeGen: name "${k}" has no value`);return(0,r._)`${w}${k.scopePath}`})}scopeCode(w=this._values,$,k){return this._reduceValues(w,_=>{if(_.value===void 0)throw new Error(`CodeGen: name "${_}" has no value`);return _.value.code},$,k)}_reduceValues(w,$,k={},_){let h=r.nil;for(const v in w){const E=w[v];if(!E)continue;const i=k[v]=k[v]||new Map;E.forEach(a=>{if(i.has(a))return;i.set(a,n.Started);let s=$(a);if(s){const t=this.opts.es5?e.varKinds.var:e.varKinds.const;h=(0,r._)`${h}${t} ${a} = ${s};${this.opts._n}`}else if(s=_?.(a))h=(0,r._)`${h}${s}${this.opts._n}`;else throw new p(a);i.set(a,n.Completed)})}return h}}e.ValueScope=f})(Ut)),Ut}var Ft;function H(){return Ft||(Ft=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const r=ft(),p=qt();var n=ft();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=qt();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};class u{optimizeNodes(){return this}optimizeNames(c,P){return this}}class d extends u{constructor(c,P,x){super(),this.varKind=c,this.name=P,this.rhs=x}render({es5:c,_n:P}){const x=c?p.varKinds.var:this.varKind,A=this.rhs===void 0?"":` = ${this.rhs}`;return`${x} ${this.name}${A};`+P}optimizeNames(c,P){if(c[this.name.str])return this.rhs&&(this.rhs=W(this.rhs,c,P)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}}class f extends u{constructor(c,P,x){super(),this.lhs=c,this.rhs=P,this.sideEffects=x}render({_n:c}){return`${this.lhs} = ${this.rhs};`+c}optimizeNames(c,P){if(!(this.lhs instanceof r.Name&&!c[this.lhs.str]&&!this.sideEffects))return this.rhs=W(this.rhs,c,P),this}get names(){const c=this.lhs instanceof r.Name?{}:{...this.lhs.names};return L(c,this.rhs)}}class m extends f{constructor(c,P,x,A){super(c,x,A),this.op=P}render({_n:c}){return`${this.lhs} ${this.op}= ${this.rhs};`+c}}class w extends u{constructor(c){super(),this.label=c,this.names={}}render({_n:c}){return`${this.label}:`+c}}class $ extends u{constructor(c){super(),this.label=c,this.names={}}render({_n:c}){return`break${this.label?` ${this.label}`:""};`+c}}class k extends u{constructor(c){super(),this.error=c}render({_n:c}){return`throw ${this.error};`+c}get names(){return this.error.names}}class _ extends u{constructor(c){super(),this.code=c}render({_n:c}){return`${this.code};`+c}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(c,P){return this.code=W(this.code,c,P),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}}class h extends u{constructor(c=[]){super(),this.nodes=c}render(c){return this.nodes.reduce((P,x)=>P+x.render(c),"")}optimizeNodes(){const{nodes:c}=this;let P=c.length;for(;P--;){const x=c[P].optimizeNodes();Array.isArray(x)?c.splice(P,1,...x):x?c[P]=x:c.splice(P,1)}return c.length>0?this:void 0}optimizeNames(c,P){const{nodes:x}=this;let A=x.length;for(;A--;){const K=x[A];K.optimizeNames(c,P)||(se(c,K.names),x.splice(A,1))}return x.length>0?this:void 0}get names(){return this.nodes.reduce((c,P)=>F(c,P.names),{})}}class v extends h{render(c){return"{"+c._n+super.render(c)+"}"+c._n}}class E extends h{}class i extends v{}i.kind="else";class a extends v{constructor(c,P){super(P),this.condition=c}render(c){let P=`if(${this.condition})`+super.render(c);return this.else&&(P+="else "+this.else.render(c)),P}optimizeNodes(){super.optimizeNodes();const c=this.condition;if(c===!0)return this.nodes;let P=this.else;if(P){const x=P.optimizeNodes();P=this.else=Array.isArray(x)?new i(x):x}if(P)return c===!1?P instanceof a?P:P.nodes:this.nodes.length?this:new a(de(c),P instanceof a?[P]:P.nodes);if(!(c===!1||!this.nodes.length))return this}optimizeNames(c,P){var x;if(this.else=(x=this.else)===null||x===void 0?void 0:x.optimizeNames(c,P),!!(super.optimizeNames(c,P)||this.else))return this.condition=W(this.condition,c,P),this}get names(){const c=super.names;return L(c,this.condition),this.else&&F(c,this.else.names),c}}a.kind="if";class s extends v{}s.kind="for";class t extends s{constructor(c){super(),this.iteration=c}render(c){return`for(${this.iteration})`+super.render(c)}optimizeNames(c,P){if(super.optimizeNames(c,P))return this.iteration=W(this.iteration,c,P),this}get names(){return F(super.names,this.iteration.names)}}class g extends s{constructor(c,P,x,A){super(),this.varKind=c,this.name=P,this.from=x,this.to=A}render(c){const P=c.es5?p.varKinds.var:this.varKind,{name:x,from:A,to:K}=this;return`for(${P} ${x}=${A}; ${x}<${K}; ${x}++)`+super.render(c)}get names(){const c=L(super.names,this.from);return L(c,this.to)}}class l extends s{constructor(c,P,x,A){super(),this.loop=c,this.varKind=P,this.name=x,this.iterable=A}render(c){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(c)}optimizeNames(c,P){if(super.optimizeNames(c,P))return this.iterable=W(this.iterable,c,P),this}get names(){return F(super.names,this.iterable.names)}}class y extends v{constructor(c,P,x){super(),this.name=c,this.args=P,this.async=x}render(c){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(c)}}y.kind="func";class b extends h{render(c){return"return "+super.render(c)}}b.kind="return";class N extends v{render(c){let P="try"+super.render(c);return this.catch&&(P+=this.catch.render(c)),this.finally&&(P+=this.finally.render(c)),P}optimizeNodes(){var c,P;return super.optimizeNodes(),(c=this.catch)===null||c===void 0||c.optimizeNodes(),(P=this.finally)===null||P===void 0||P.optimizeNodes(),this}optimizeNames(c,P){var x,A;return super.optimizeNames(c,P),(x=this.catch)===null||x===void 0||x.optimizeNames(c,P),(A=this.finally)===null||A===void 0||A.optimizeNames(c,P),this}get names(){const c=super.names;return this.catch&&F(c,this.catch.names),this.finally&&F(c,this.finally.names),c}}class M extends v{constructor(c){super(),this.error=c}render(c){return`catch(${this.error})`+super.render(c)}}M.kind="catch";class V extends v{render(c){return"finally"+super.render(c)}}V.kind="finally";class z{constructor(c,P={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...P,_n:P.lines?`
|
|
2
2
|
`:""},this._extScope=c,this._scope=new p.Scope({parent:c}),this._nodes=[new E]}toString(){return this._root.render(this.opts)}name(c){return this._scope.name(c)}scopeName(c){return this._extScope.name(c)}scopeValue(c,P){const x=this._extScope.value(c,P);return(this._values[x.prefix]||(this._values[x.prefix]=new Set)).add(x),x}getScopeValue(c,P){return this._extScope.getValue(c,P)}scopeRefs(c){return this._extScope.scopeRefs(c,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(c,P,x,A){const K=this._scope.toName(P);return x!==void 0&&A&&(this._constants[K.str]=x),this._leafNode(new d(c,K,x)),K}const(c,P,x){return this._def(p.varKinds.const,c,P,x)}let(c,P,x){return this._def(p.varKinds.let,c,P,x)}var(c,P,x){return this._def(p.varKinds.var,c,P,x)}assign(c,P,x){return this._leafNode(new f(c,P,x))}add(c,P){return this._leafNode(new m(c,e.operators.ADD,P))}code(c){return typeof c=="function"?c():c!==r.nil&&this._leafNode(new _(c)),this}object(...c){const P=["{"];for(const[x,A]of c)P.length>1&&P.push(","),P.push(x),(x!==A||this.opts.es5)&&(P.push(":"),(0,r.addCodeArg)(P,A));return P.push("}"),new r._Code(P)}if(c,P,x){if(this._blockNode(new a(c)),P&&x)this.code(P).else().code(x).endIf();else if(P)this.code(P).endIf();else if(x)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(c){return this._elseNode(new a(c))}else(){return this._elseNode(new i)}endIf(){return this._endBlockNode(a,i)}_for(c,P){return this._blockNode(c),P&&this.code(P).endFor(),this}for(c,P){return this._for(new t(c),P)}forRange(c,P,x,A,K=this.opts.es5?p.varKinds.var:p.varKinds.let){const Q=this._scope.toName(c);return this._for(new g(K,Q,P,x),()=>A(Q))}forOf(c,P,x,A=p.varKinds.const){const K=this._scope.toName(c);if(this.opts.es5){const Q=P instanceof r.Name?P:this.var("_arr",P);return this.forRange("_i",0,(0,r._)`${Q}.length`,B=>{this.var(K,(0,r._)`${Q}[${B}]`),x(K)})}return this._for(new l("of",A,K,P),()=>x(K))}forIn(c,P,x,A=this.opts.es5?p.varKinds.var:p.varKinds.const){if(this.opts.ownProperties)return this.forOf(c,(0,r._)`Object.keys(${P})`,x);const K=this._scope.toName(c);return this._for(new l("in",A,K,P),()=>x(K))}endFor(){return this._endBlockNode(s)}label(c){return this._leafNode(new w(c))}break(c){return this._leafNode(new $(c))}return(c){const P=new b;if(this._blockNode(P),this.code(c),P.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(b)}try(c,P,x){if(!P&&!x)throw new Error('CodeGen: "try" without "catch" and "finally"');const A=new N;if(this._blockNode(A),this.code(c),P){const K=this.name("e");this._currNode=A.catch=new M(K),P(K)}return x&&(this._currNode=A.finally=new V,this.code(x)),this._endBlockNode(M,V)}throw(c){return this._leafNode(new k(c))}block(c,P){return this._blockStarts.push(this._nodes.length),c&&this.code(c).endBlock(P),this}endBlock(c){const P=this._blockStarts.pop();if(P===void 0)throw new Error("CodeGen: not in self-balancing block");const x=this._nodes.length-P;if(x<0||c!==void 0&&x!==c)throw new Error(`CodeGen: wrong number of nodes: ${x} vs ${c} expected`);return this._nodes.length=P,this}func(c,P=r.nil,x,A){return this._blockNode(new y(c,P,x)),A&&this.code(A).endFunc(),this}endFunc(){return this._endBlockNode(y)}optimize(c=1){for(;c-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(c){return this._currNode.nodes.push(c),this}_blockNode(c){this._currNode.nodes.push(c),this._nodes.push(c)}_endBlockNode(c,P){const x=this._currNode;if(x instanceof c||P&&x instanceof P)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${P?`${c.kind}/${P.kind}`:c.kind}"`)}_elseNode(c){const P=this._currNode;if(!(P instanceof a))throw new Error('CodeGen: "else" without "if"');return this._currNode=P.else=c,this}get _root(){return this._nodes[0]}get _currNode(){const c=this._nodes;return c[c.length-1]}set _currNode(c){const P=this._nodes;P[P.length-1]=c}}e.CodeGen=z;function F(C,c){for(const P in c)C[P]=(C[P]||0)+(c[P]||0);return C}function L(C,c){return c instanceof r._CodeOrName?F(C,c.names):C}function W(C,c,P){if(C instanceof r.Name)return x(C);if(!A(C))return C;return new r._Code(C._items.reduce((K,Q)=>(Q instanceof r.Name&&(Q=x(Q)),Q instanceof r._Code?K.push(...Q._items):K.push(Q),K),[]));function x(K){const Q=P[K.str];return Q===void 0||c[K.str]!==1?K:(delete c[K.str],Q)}function A(K){return K instanceof r._Code&&K._items.some(Q=>Q instanceof r.Name&&c[Q.str]===1&&P[Q.str]!==void 0)}}function se(C,c){for(const P in c)C[P]=(C[P]||0)-(c[P]||0)}function de(C){return typeof C=="boolean"||typeof C=="number"||C===null?!C:(0,r._)`!${T(C)}`}e.not=de;const fe=j(e.operators.AND);function Y(...C){return C.reduce(fe)}e.and=Y;const ye=j(e.operators.OR);function R(...C){return C.reduce(ye)}e.or=R;function j(C){return(c,P)=>c===r.nil?P:P===r.nil?c:(0,r._)`${T(c)} ${C} ${T(P)}`}function T(C){return C instanceof r.Name?C:(0,r._)`(${C})`}})(Vt)),Vt}var q={},Lt;function J(){if(Lt)return q;Lt=1,Object.defineProperty(q,"__esModule",{value:!0}),q.checkStrictMode=q.getErrorPath=q.Type=q.useFunc=q.setEvaluated=q.evaluatedPropsToName=q.mergeEvaluated=q.eachItem=q.unescapeJsonPointer=q.escapeJsonPointer=q.escapeFragment=q.unescapeFragment=q.schemaRefOrVal=q.schemaHasRulesButRef=q.schemaHasRules=q.checkUnknownRules=q.alwaysValidSchema=q.toHash=void 0;const e=H(),r=ft();function p(l){const y={};for(const b of l)y[b]=!0;return y}q.toHash=p;function n(l,y){return typeof y=="boolean"?y:Object.keys(y).length===0?!0:(o(l,y),!u(y,l.self.RULES.all))}q.alwaysValidSchema=n;function o(l,y=l.schema){const{opts:b,self:N}=l;if(!b.strictSchema||typeof y=="boolean")return;const M=N.RULES.keywords;for(const V in y)M[V]||g(l,`unknown keyword: "${V}"`)}q.checkUnknownRules=o;function u(l,y){if(typeof l=="boolean")return!l;for(const b in l)if(y[b])return!0;return!1}q.schemaHasRules=u;function d(l,y){if(typeof l=="boolean")return!l;for(const b in l)if(b!=="$ref"&&y.all[b])return!0;return!1}q.schemaHasRulesButRef=d;function f({topSchemaRef:l,schemaPath:y},b,N,M){if(!M){if(typeof b=="number"||typeof b=="boolean")return b;if(typeof b=="string")return(0,e._)`${b}`}return(0,e._)`${l}${y}${(0,e.getProperty)(N)}`}q.schemaRefOrVal=f;function m(l){return k(decodeURIComponent(l))}q.unescapeFragment=m;function w(l){return encodeURIComponent($(l))}q.escapeFragment=w;function $(l){return typeof l=="number"?`${l}`:l.replace(/~/g,"~0").replace(/\//g,"~1")}q.escapeJsonPointer=$;function k(l){return l.replace(/~1/g,"/").replace(/~0/g,"~")}q.unescapeJsonPointer=k;function _(l,y){if(Array.isArray(l))for(const b of l)y(b);else y(l)}q.eachItem=_;function h({mergeNames:l,mergeToName:y,mergeValues:b,resultToName:N}){return(M,V,z,F)=>{const L=z===void 0?V:z instanceof e.Name?(V instanceof e.Name?l(M,V,z):y(M,V,z),z):V instanceof e.Name?(y(M,z,V),V):b(V,z);return F===e.Name&&!(L instanceof e.Name)?N(M,L):L}}q.mergeEvaluated={props:h({mergeNames:(l,y,b)=>l.if((0,e._)`${b} !== true && ${y} !== undefined`,()=>{l.if((0,e._)`${y} === true`,()=>l.assign(b,!0),()=>l.assign(b,(0,e._)`${b} || {}`).code((0,e._)`Object.assign(${b}, ${y})`))}),mergeToName:(l,y,b)=>l.if((0,e._)`${b} !== true`,()=>{y===!0?l.assign(b,!0):(l.assign(b,(0,e._)`${b} || {}`),E(l,b,y))}),mergeValues:(l,y)=>l===!0?!0:{...l,...y},resultToName:v}),items:h({mergeNames:(l,y,b)=>l.if((0,e._)`${b} !== true && ${y} !== undefined`,()=>l.assign(b,(0,e._)`${y} === true ? true : ${b} > ${y} ? ${b} : ${y}`)),mergeToName:(l,y,b)=>l.if((0,e._)`${b} !== true`,()=>l.assign(b,y===!0?!0:(0,e._)`${b} > ${y} ? ${b} : ${y}`)),mergeValues:(l,y)=>l===!0?!0:Math.max(l,y),resultToName:(l,y)=>l.var("items",y)})};function v(l,y){if(y===!0)return l.var("props",!0);const b=l.var("props",(0,e._)`{}`);return y!==void 0&&E(l,b,y),b}q.evaluatedPropsToName=v;function E(l,y,b){Object.keys(b).forEach(N=>l.assign((0,e._)`${y}${(0,e.getProperty)(N)}`,!0))}q.setEvaluated=E;const i={};function a(l,y){return l.scopeValue("func",{ref:y,code:i[y.code]||(i[y.code]=new r._Code(y.code))})}q.useFunc=a;var s;(function(l){l[l.Num=0]="Num",l[l.Str=1]="Str"})(s||(q.Type=s={}));function t(l,y,b){if(l instanceof e.Name){const N=y===s.Num;return b?N?(0,e._)`"[" + ${l} + "]"`:(0,e._)`"['" + ${l} + "']"`:N?(0,e._)`"/" + ${l}`:(0,e._)`"/" + ${l}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return b?(0,e.getProperty)(l).toString():"/"+$(l)}q.getErrorPath=t;function g(l,y,b=l.opts.strictSchema){if(b){if(y=`strict mode: ${y}`,b===!0)throw new Error(y);l.self.logger.warn(y)}}return q.checkStrictMode=g,q}var Ce={},Gt;function ge(){if(Gt)return Ce;Gt=1,Object.defineProperty(Ce,"__esModule",{value:!0});const e=H(),r={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return Ce.default=r,Ce}var Ht;function pt(){return Ht||(Ht=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const r=H(),p=J(),n=ge();e.keywordError={message:({keyword:i})=>(0,r.str)`must pass "${i}" keyword validation`},e.keyword$DataError={message:({keyword:i,schemaType:a})=>a?(0,r.str)`"${i}" keyword must be ${a} ($data)`:(0,r.str)`"${i}" keyword is invalid ($data)`};function o(i,a=e.keywordError,s,t){const{it:g}=i,{gen:l,compositeRule:y,allErrors:b}=g,N=k(i,a,s);t??(y||b)?m(l,N):w(g,(0,r._)`[${N}]`)}e.reportError=o;function u(i,a=e.keywordError,s){const{it:t}=i,{gen:g,compositeRule:l,allErrors:y}=t,b=k(i,a,s);m(g,b),l||y||w(t,n.default.vErrors)}e.reportExtraError=u;function d(i,a){i.assign(n.default.errors,a),i.if((0,r._)`${n.default.vErrors} !== null`,()=>i.if(a,()=>i.assign((0,r._)`${n.default.vErrors}.length`,a),()=>i.assign(n.default.vErrors,null)))}e.resetErrorsCount=d;function f({gen:i,keyword:a,schemaValue:s,data:t,errsCount:g,it:l}){if(g===void 0)throw new Error("ajv implementation error");const y=i.name("err");i.forRange("i",g,n.default.errors,b=>{i.const(y,(0,r._)`${n.default.vErrors}[${b}]`),i.if((0,r._)`${y}.instancePath === undefined`,()=>i.assign((0,r._)`${y}.instancePath`,(0,r.strConcat)(n.default.instancePath,l.errorPath))),i.assign((0,r._)`${y}.schemaPath`,(0,r.str)`${l.errSchemaPath}/${a}`),l.opts.verbose&&(i.assign((0,r._)`${y}.schema`,s),i.assign((0,r._)`${y}.data`,t))})}e.extendErrors=f;function m(i,a){const s=i.const("err",a);i.if((0,r._)`${n.default.vErrors} === null`,()=>i.assign(n.default.vErrors,(0,r._)`[${s}]`),(0,r._)`${n.default.vErrors}.push(${s})`),i.code((0,r._)`${n.default.errors}++`)}function w(i,a){const{gen:s,validateName:t,schemaEnv:g}=i;g.$async?s.throw((0,r._)`new ${i.ValidationError}(${a})`):(s.assign((0,r._)`${t}.errors`,a),s.return(!1))}const $={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function k(i,a,s){const{createErrors:t}=i.it;return t===!1?(0,r._)`{}`:_(i,a,s)}function _(i,a,s={}){const{gen:t,it:g}=i,l=[h(g,s),v(i,s)];return E(i,a,l),t.object(...l)}function h({errorPath:i},{instancePath:a}){const s=a?(0,r.str)`${i}${(0,p.getErrorPath)(a,p.Type.Str)}`:i;return[n.default.instancePath,(0,r.strConcat)(n.default.instancePath,s)]}function v({keyword:i,it:{errSchemaPath:a}},{schemaPath:s,parentSchema:t}){let g=t?a:(0,r.str)`${a}/${i}`;return s&&(g=(0,r.str)`${g}${(0,p.getErrorPath)(s,p.Type.Str)}`),[$.schemaPath,g]}function E(i,{params:a,message:s},t){const{keyword:g,data:l,schemaValue:y,it:b}=i,{opts:N,propertyName:M,topSchemaRef:V,schemaPath:z}=b;t.push([$.keyword,g],[$.params,typeof a=="function"?a(i):a||(0,r._)`{}`]),N.messages&&t.push([$.message,typeof s=="function"?s(i):s]),N.verbose&&t.push([$.schema,y],[$.parentSchema,(0,r._)`${V}${z}`],[n.default.data,l]),M&&t.push([$.propertyName,M])}})(Dt)),Dt}var Bt;function _s(){if(Bt)return $e;Bt=1,Object.defineProperty($e,"__esModule",{value:!0}),$e.boolOrEmptySchema=$e.topBoolOrEmptySchema=void 0;const e=pt(),r=H(),p=ge(),n={message:"boolean schema is false"};function o(f){const{gen:m,schema:w,validateName:$}=f;w===!1?d(f,!1):typeof w=="object"&&w.$async===!0?m.return(p.default.data):(m.assign((0,r._)`${$}.errors`,null),m.return(!0))}$e.topBoolOrEmptySchema=o;function u(f,m){const{gen:w,schema:$}=f;$===!1?(w.var(m,!1),d(f)):w.var(m,!0)}$e.boolOrEmptySchema=u;function d(f,m){const{gen:w,data:$}=f,k={gen:w,keyword:"false schema",data:$,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:f};(0,e.reportError)(k,n,void 0,m)}return $e}var te={},we={},Jt;function ns(){if(Jt)return we;Jt=1,Object.defineProperty(we,"__esModule",{value:!0}),we.getRules=we.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],r=new Set(e);function p(o){return typeof o=="string"&&r.has(o)}we.isJSONType=p;function n(){const o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}return we.getRules=n,we}var pe={},Qt;function os(){if(Qt)return pe;Qt=1,Object.defineProperty(pe,"__esModule",{value:!0}),pe.shouldUseRule=pe.shouldUseGroup=pe.schemaHasRulesForType=void 0;function e({schema:n,self:o},u){const d=o.RULES.types[u];return d&&d!==!0&&r(n,d)}pe.schemaHasRulesForType=e;function r(n,o){return o.rules.some(u=>p(n,u))}pe.shouldUseGroup=r;function p(n,o){var u;return n[o.keyword]!==void 0||((u=o.definition.implements)===null||u===void 0?void 0:u.some(d=>n[d]!==void 0))}return pe.shouldUseRule=p,pe}var Wt;function ht(){if(Wt)return te;Wt=1,Object.defineProperty(te,"__esModule",{value:!0}),te.reportTypeError=te.checkDataTypes=te.checkDataType=te.coerceAndCheckDataType=te.getJSONTypes=te.getSchemaTypes=te.DataType=void 0;const e=ns(),r=os(),p=pt(),n=H(),o=J();var u;(function(s){s[s.Correct=0]="Correct",s[s.Wrong=1]="Wrong"})(u||(te.DataType=u={}));function d(s){const t=f(s.type);if(t.includes("null")){if(s.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&s.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');s.nullable===!0&&t.push("null")}return t}te.getSchemaTypes=d;function f(s){const t=Array.isArray(s)?s:s?[s]:[];if(t.every(e.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}te.getJSONTypes=f;function m(s,t){const{gen:g,data:l,opts:y}=s,b=$(t,y.coerceTypes),N=t.length>0&&!(b.length===0&&t.length===1&&(0,r.schemaHasRulesForType)(s,t[0]));if(N){const M=v(t,l,y.strictNumbers,u.Wrong);g.if(M,()=>{b.length?k(s,t,b):i(s)})}return N}te.coerceAndCheckDataType=m;const w=new Set(["string","number","integer","boolean","null"]);function $(s,t){return t?s.filter(g=>w.has(g)||t==="array"&&g==="array"):[]}function k(s,t,g){const{gen:l,data:y,opts:b}=s,N=l.let("dataType",(0,n._)`typeof ${y}`),M=l.let("coerced",(0,n._)`undefined`);b.coerceTypes==="array"&&l.if((0,n._)`${N} == 'object' && Array.isArray(${y}) && ${y}.length == 1`,()=>l.assign(y,(0,n._)`${y}[0]`).assign(N,(0,n._)`typeof ${y}`).if(v(t,y,b.strictNumbers),()=>l.assign(M,y))),l.if((0,n._)`${M} !== undefined`);for(const z of g)(w.has(z)||z==="array"&&b.coerceTypes==="array")&&V(z);l.else(),i(s),l.endIf(),l.if((0,n._)`${M} !== undefined`,()=>{l.assign(y,M),_(s,M)});function V(z){switch(z){case"string":l.elseIf((0,n._)`${N} == "number" || ${N} == "boolean"`).assign(M,(0,n._)`"" + ${y}`).elseIf((0,n._)`${y} === null`).assign(M,(0,n._)`""`);return;case"number":l.elseIf((0,n._)`${N} == "boolean" || ${y} === null
|
|
3
3
|
|| (${N} == "string" && ${y} && ${y} == +${y})`).assign(M,(0,n._)`+${y}`);return;case"integer":l.elseIf((0,n._)`${N} === "boolean" || ${y} === null
|
|
4
4
|
|| (${N} === "string" && ${y} && ${y} == +${y} && !(${y} % 1))`).assign(M,(0,n._)`+${y}`);return;case"boolean":l.elseIf((0,n._)`${y} === "false" || ${y} === 0 || ${y} === null`).assign(M,!1).elseIf((0,n._)`${y} === "true" || ${y} === 1`).assign(M,!0);return;case"null":l.elseIf((0,n._)`${y} === "" || ${y} === 0 || ${y} === false`),l.assign(M,null);return;case"array":l.elseIf((0,n._)`${N} === "string" || ${N} === "number"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Z as r,af as e,ag as i}from"../../js/index-C4LjLCAZ.js";const l=i("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current"}},defaultVariants:{variant:"default"}});function n({className:t,variant:a,...s}){return r.jsx("div",{"data-slot":"alert",role:"alert",className:e(l({variant:a}),t),...s})}function c({className:t,...a}){return r.jsx("div",{"data-slot":"alert-title",className:e("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...a})}function o({className:t,...a}){return r.jsx("div",{"data-slot":"alert-description",className:e("col-start-2 grid justify-items-start gap-1 text-sm text-muted-foreground [&_p]:leading-relaxed",t),...a})}export{c as g,l,n as o,o as u};
|