@mohsinonxrm/pptb-commandbar-studio 0.9.0 → 0.10.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +167 -0
  2. package/README.md +16 -14
  3. package/dist/assets/BulkPublishModal-9_XxYmS2.js +2 -0
  4. package/dist/assets/CommandEditorPanel-BtBG8540.js +1 -0
  5. package/dist/assets/CommandPalette-C2YXN_gD.js +1 -0
  6. package/dist/assets/CompareView-Beq5V68_.js +11 -0
  7. package/dist/assets/CrmParameterEditor-DfZv5BuF.js +1 -0
  8. package/dist/assets/EditorDrawer-D0K8zHVK.js +2 -0
  9. package/dist/assets/HideInsteadOfDeleteModal-C4AKxh50.js +1 -0
  10. package/dist/assets/IconPickerModal-B9UeIP7Z.js +1 -0
  11. package/dist/assets/ImportXmlModal-Cf75oVpN.js +1 -0
  12. package/dist/assets/{MonacoEditor-CEYP9b6u.js → MonacoEditor-B3J81C8F.js} +2 -2
  13. package/dist/assets/NewButtonModal-DhGNLWEW.js +1 -0
  14. package/dist/assets/NewGroupModal-CMLOZ15C.js +1 -0
  15. package/dist/assets/NewTabModal-N7FF7DT1.js +1 -0
  16. package/dist/assets/RuleEditorPanel-C9CcMM1s.js +1 -0
  17. package/dist/assets/ScriptView-B0ILfTWe.js +1 -0
  18. package/dist/assets/TabDisplayRulesPanel-DVMEaWWv.js +1 -0
  19. package/dist/assets/TitleTranslationsView-C68zJcNK.js +1 -0
  20. package/dist/assets/TranslationsView-BZXsG_LU.js +1 -0
  21. package/dist/assets/WebResourceBrowser-DEXq2SCy.js +1 -0
  22. package/dist/assets/XmlView-DEUwTHCt.js +2 -0
  23. package/dist/assets/crmParameters-Dxz06tk4.js +1 -0
  24. package/dist/assets/{dnd-iy5K5XAJ.js → dnd-C19d6Mn0.js} +1 -1
  25. package/dist/assets/fluent-ui-BThr2m8u.js +59 -0
  26. package/dist/assets/index-Df9NSpg6.js +136 -0
  27. package/dist/assets/index-browser-Bmt9T2GD.js +2 -0
  28. package/dist/assets/languages-CGjPBPNA.js +1 -0
  29. package/dist/assets/{monaco-cQE5XS3B.js → monaco-DzBcrxae.js} +1 -1
  30. package/dist/assets/monacoSetup-BRltj-y7.js +1 -0
  31. package/dist/assets/publishService-CKoTOngS.js +36 -0
  32. package/dist/assets/ribbonXsdCheck-CJBpxpVm.js +1923 -0
  33. package/dist/assets/{server.browser-DTeSoizu.js → server.browser-BokSAg1N.js} +1 -1
  34. package/dist/assets/useReplaceWebResourceConfirm-BUfgdCRQ.js +1 -0
  35. package/dist/assets/{useStableKeys-49o4VnxU.js → useStableKeys-EsghhjoV.js} +1 -1
  36. package/dist/assets/xmlValidator-Dki8Hf7Y.js +3 -0
  37. package/dist/assets/xmllint-CcuGSrO9.wasm +0 -0
  38. package/dist/assets/xmllint-browser-C85XrDSU.js +4 -0
  39. package/dist/icons/icon.svg +11 -4
  40. package/dist/index.html +3 -3
  41. package/package.json +2 -1
  42. package/dist/assets/BulkPublishModal-BWRed6Fv.js +0 -36
  43. package/dist/assets/CommandEditorPanel-B7W3Sqiu.js +0 -1
  44. package/dist/assets/CommandPalette-Fc4MPKvd.js +0 -1
  45. package/dist/assets/CompareView-D1FOwnU1.js +0 -7
  46. package/dist/assets/CrmParameterEditor-DO6Rt764.js +0 -1
  47. package/dist/assets/EditorDrawer-BtFb9OzQ.js +0 -2
  48. package/dist/assets/HideInsteadOfDeleteModal-fdtkLfSG.js +0 -1
  49. package/dist/assets/IconPickerModal-FyQ9ud3R.js +0 -1
  50. package/dist/assets/ImportXmlModal-BZq0Iglk.js +0 -1
  51. package/dist/assets/NewButtonModal-5nQ-f2by.js +0 -1
  52. package/dist/assets/NewGroupModal-vEuxSpnD.js +0 -1
  53. package/dist/assets/NewTabModal-DNzMru8E.js +0 -1
  54. package/dist/assets/RuleEditorPanel-B0u4b6vi.js +0 -1
  55. package/dist/assets/ScriptView-Ct4i8Jja.js +0 -1
  56. package/dist/assets/TabDisplayRulesPanel-HMmGkIxe.js +0 -1
  57. package/dist/assets/TranslationsView-DT4Ce3_W.js +0 -1
  58. package/dist/assets/WebResourceBrowser-L3R7UTNR.js +0 -1
  59. package/dist/assets/XmlView-CyLtgYex.js +0 -2
  60. package/dist/assets/crmParameters-rgfZhhzN.js +0 -1
  61. package/dist/assets/fluent-ui-CQyNN9H3.js +0 -59
  62. package/dist/assets/index-D7TexD30.js +0 -136
  63. package/dist/assets/monacoSetup-BIq1zGyP.js +0 -1
  64. package/dist/assets/ruleKinds-BKTUiZ1-.js +0 -1
  65. package/dist/assets/useReplaceWebResourceConfirm-BdTw98QF.js +0 -1
  66. package/dist/assets/xmlValidator-xIq-x9Ub.js +0 -3
@@ -0,0 +1 @@
1
+ import{r as W,j as c,c as X,z as de,af as ze,ag as Fe,B as Ne,k as _,m as Pe,t as E}from"./fluent-ui-BThr2m8u.js";import{z as ve,B as We,C as Ue,K as _e,D as Je,F as Ye,G as Ke,b as ne,d as De,A as Ve,a as Qe,o as Ze}from"./index-Df9NSpg6.js";import{v as et}from"./xmlValidator-Dki8Hf7Y.js";import{M as tt}from"./MonacoEditor-B3J81C8F.js";import"./preload-helper-PPVm8Dsz.js";import"./dnd-C19d6Mn0.js";import"./crmParameters-Dxz06tk4.js";const ge=["HomepageGrid","SubGrid","Form"],ue=[...ge,"Application"],pe=new Set(["Button","FlyoutAnchor","SplitButton","TextBox","ComboBox","CheckBox"]),me=new Set(["flyout","splitButton"]),he=/^Mscrm\.(HomepageGrid|SubGrid|Form)\.([^.]+)\./,Ie="._children",ot=/<(EnableRule|DisplayRule)\b[^>]*?\sId="([^"]+)"/,fe=/\$LocLabels:([^"'\s<]+)/g,Le="cbs.import.Tab",nt="cbs.import.Group",je=(i,f)=>JSON.stringify(i)===JSON.stringify(f);function U(i){return i?Array.from(i.children):[]}function st(i){return Object.fromEntries(Array.from(i.attributes).map(f=>[f.name,f.value]))}function it(i,f,d){const m=i.documentElement;if(m.tagName==="RibbonDiffXml")return m;const h=Array.from(i.getElementsByTagName("RibbonDiffXml")),$=Array.from(i.querySelectorAll("Entities > Entity")).flatMap(l=>{const A=U(l),O=A.find(I=>I.tagName==="RibbonDiffXml"),T=A.find(I=>I.tagName==="Name")?.textContent?.trim()??"";return O?[{name:T,rdx:O}]:[]}),w=h.find(l=>l.parentElement===m);if($.length===0&&!w){if(h.length===1)return h[0];throw new Error(h.length===0?"No <RibbonDiffXml> element found.":`The XML has ${h.length} <RibbonDiffXml> elements and none belongs to an entity or the application ribbon — paste just one.`)}const G=[...$.map(l=>l.name||"(unnamed entity)"),...w?["the application ribbon"]:[]].join(", ");if(d){if(w)return w;throw new Error(`The XML has no application ribbon RibbonDiffXml (it has: ${G}). Open that entity's ribbon to import its customizations.`)}const S=$.find(l=>l.name.toLowerCase()===f.toLowerCase());if(S)return S.rdx;throw new Error(`The XML has no RibbonDiffXml for ${f||"the loaded entity"} (it has: ${G}). Load that entity, or open the application ribbon for the application ribbon's customizations.`)}function rt(i){switch(i){case"HomePageGrid":return"HomepageGrid";case"Form":return"Form";case"SubGridStandard":case"SubGridAssociated":return"SubGrid";default:return}}function at(i){const f=i.languageCode??1033,d=i.entityLogicalName,m=new DOMParser().parseFromString(i.xml,"application/xml");if(m.querySelector("parsererror"))throw new Error("The XML is not well-formed.");const h=i.activeLocation==="Application",$=it(m,d,h),w=new XMLSerializer,G=w.serializeToString($),S=[],l=[],A=[],O=!!d&&new RegExp(`Mscrm\\.(HomepageGrid|SubGrid|Form)\\.${d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\.`,"i").test(G),T=h&&!($===m.documentElement&&O);$!==m.documentElement?A.push(`Imported the RibbonDiffXml of ${T?"the application ribbon":d} from the document.`):h&&!T&&A.push(`The XML's Locations name the ${d} entity, so it was imported as that entity's customizations, not the application ribbon's.`);const I=T?"Application":ge.includes(i.activeLocation)?i.activeLocation:"HomepageGrid",M=ve(G,i.activeLocation,d),H=(e,t,o)=>{const s=new Map,n=new Map;for(const y of t)s.set(y.id,y),n.set(y.id,(n.get(y.id)??0)+1);for(const[y,x]of n)x>1&&A.push(`${o} ${y} is defined ${x} times in the XML — the last one was used.`);const u=Array.from(s.values()),a=[...e],p=[];let b=0;for(const y of u){const x=a.findIndex(D=>D.id===y.id);if(x>=0&&je(a[x],y)){b++;continue}S.push(`${o} ${y.id} ${x>=0?"updated":"added"}`),x>=0?a[x]=y:a.push(y),p.push(y.id)}return{out:a,changedIds:p,unchanged:b}},L=H(i.commands,M.commands,"Command"),z=H(i.enableRules,M.enableRules,"Enable rule"),N=H(i.displayRules,M.displayRules,"Display rule"),C=H(i.locLabels,M.locLabels,"Label"),k=C.out,q=L.unchanged+z.unchanged+N.unchanged+C.unchanged,B=(e,t)=>e&&Ke(e,k,f)||t,j=JSON.parse(JSON.stringify(i.ribbons));let v=!1,F=0;const r=new Set,g=e=>{if(T)return ue.slice().reverse();const t=he.exec(e),o=t&&t[2]!=="{!EntityLogicalName}"?t[1]:I;return[o,...ge.filter(s=>s!==o),"Application"]},R=(e,t)=>{T&&e!=="Application"?A.push(`${t} is on the entity's ribbon (${e}), not the application ribbon: the change is published with the entity.`):!T&&e==="Application"&&A.push(`${t} was found only on the application ribbon: the change is published to the application ribbon and affects every entity.`)},ie=[],P=(e,t)=>{e&&e!==t&&ie.push(e)},J=e=>{for(const t of g(e))for(const o of j[t].tabs){const s=o.groups.find(n=>n.id===e);if(s)return{location:t,tab:o,group:s}}},Y=e=>{for(const t of g(e)){const o=j[t].tabs.find(s=>s.id===e);if(o)return{location:t,tab:o}}},K=e=>{for(const t of g(e)){const o=[];for(const s of j[t].tabs)for(const n of s.groups)for(const u of n.buttons)u.id===e&&o.push({group:n,button:u});if(o.length>0)return{location:t,found:o}}},V=(e,t)=>{const o=he.exec(t);let s="it isn't in the loaded ribbon";o&&o[2]!=="{!EntityLogicalName}"&&d&&o[2]!==d?s=`it belongs to the ${o[2]} entity, but ${d} is loaded`:(o?.[2]==="{!EntityLogicalName}"||t.startsWith("Mscrm.Global"))&&(s="it belongs to the application ribbon, which isn't loaded with it"),l.push(`${e}: Location "${t}" not found — ${s}.`)},Ee=U($.querySelector(":scope > RuleDefinitions > TabDisplayRules")).map(e=>w.serializeToString(e)).join(""),re=e=>ve(`<RibbonDiffXml><UI><Ribbon><Tabs>${e}</Tabs></Ribbon></UI><RuleDefinitions><TabDisplayRules>${Ee}</TabDisplayRules></RuleDefinitions></RibbonDiffXml>`,i.activeLocation,d,k).ribbon.tabs[0],Q=e=>w.serializeToString(e),ye=e=>re(`<Tab Id="${Le}"><Groups><Group Id="${nt}"><Controls>${Q(e)}</Controls></Group></Groups></Tab>`)?.groups[0]?.buttons.find(t=>t.id===e.getAttribute("Id")),xe=e=>{const t=e.source;t&&(e.label=B(t.labelToken,e.id),t.tooltipTitleToken&&(e.tooltipTitle=B(t.tooltipTitleToken,"")),t.tooltipBodyToken&&(e.tooltipBody=B(t.tooltipBodyToken,"")))},Z=e=>{for(const t of e.source?.xml?[e.source.xml]:Object.values(e.source?.attributes??{}))for(const[,o]of t.matchAll(fe))k.some(s=>s.id===o)||l.push(`${e.id}: references label ${o}, which neither the XML nor the loaded ribbon defines — add its <LocLabel>, or its text won't show unless another solution defines it (the pre-publish check warns).`)},$e=e=>({titleToken:e.getAttribute("Title")??void 0,attributes:st(e)}),Ae=(e,t)=>(Ye(e,{origin:"unmanaged"}),e.hidden=!1,t!==void 0&&!e.source?.attributes.Sequence&&(e.sequence=t),xe(e),Z(e),e),ae=e=>l.push(`${e}: flyout / split buttons and their menus can't be imported yet (#27).`),Oe=(e,t)=>{const o=new Set(Array.from(e.querySelectorAll("Menu *")).map(n=>n.getAttribute("Id")).filter(n=>!!n)),s=[];for(const n of t?.buttons??[])o.has(n.id)||(me.has(n.kind)?ae(n.id):s.push(Ae(n)));return s},ee=(e,t)=>{const o=e.findIndex(s=>s.sequence>t.sequence);e.splice(o<0?e.length:o,0,t)},we=(e,t,o)=>{const s=K(e),n=ye(t);if(!s||!n)return!1;xe(n),Z(n),R(s.location,e);for(const{group:u,button:a}of s.found){if(n.kind!==a.kind)return l.push(`${e}: changing a <${t.tagName}> into another kind of control isn't supported.`),!0;if(me.has(a.kind))return ae(e),!0;const p=JSON.parse(JSON.stringify(a));Object.assign(a,{label:n.label,tooltipTitle:n.tooltipTitle,tooltipBody:n.tooltipBody,icon:n.icon,image16:n.image16,image32:n.image32,commandId:n.commandId,templateAlias:n.templateAlias||a.templateAlias,source:structuredClone(n.source)});const b=n.source?.attributes.Sequence?n.sequence:o;b!==void 0&&b!==a.sequence&&(a.origin==="unmanaged"?(u.buttons.splice(u.buttons.indexOf(a),1),a.sequence=b,ee(u.buttons,a)):l.push(`${e}: Sequence ${b} not applied — only your own buttons can be re-ordered.`)),Je(p,a)||p.sequence!==a.sequence?(v=!0,S.push(`Updated ${a.label} (${e}) on ${s.location}`),n.templateAlias||A.push(`${e}: the override has no TemplateAlias — ${a.templateAlias} from the loaded control is kept.`)):(Object.assign(a,p),je(p.source?.attributes,n.source?.attributes)?F++:l.push(`${e}: the override only changes attributes CBS doesn't publish yet (label, tooltip, icon, command and template alias are).`))}return!0},Ce=(e,t,o,s)=>{const n=t.getAttribute("Id");if(!n)return l.push(`CustomAction ${e.getAttribute("Id")}: the control has no Id.`);const u=K(n);if(u){u.found.some(b=>b.group.id===o)||l.push(`${n}: already in group ${u.found[0].group.id} — updated there, not moved to ${o}.`),we(n,t,s)&&P(e.getAttribute("Id"),`${n}.Override.CustomAction`);return}const a=J(o);if(!a)return V(`${n}`,e.getAttribute("Location")??"");const p=ye(t);if(!p)return l.push(`${n}: couldn't read the <${t.tagName}>.`);if(me.has(p.kind))return ae(n);ee(a.group.buttons,Ae(p,s)),R(a.location,n),P(e.getAttribute("Id"),`${n}.CustomAction`),v=!0,S.push(`Added ${p.label} (${n}) to ${a.group.id} on ${a.location}`)},Se=(e,t)=>{const o=re(`<Tab Id="${Le}"><Groups>${Q(e)}</Groups></Tab>`)?.groups[0];if(!o)return;const s=$e(e);return Z({id:o.id,source:s}),{...o,label:B(s.titleToken,o.id),source:s,sequence:e.getAttribute("Sequence")===null?t??o.sequence:o.sequence,buttons:Oe(e,o)}},ke=(e,t,o,s)=>{const n=t.getAttribute("Id");if(!n)return l.push(`CustomAction ${e.getAttribute("Id")}: the group has no Id.`);if(J(n)){l.push(`Group ${n} already exists — it was left as is (re-titling groups isn't supported).`);for(const b of U(t.querySelector(":scope > Controls")))pe.has(b.tagName)?Ce(e,b,n,void 0):Ue(_e[b.tagName])&&l.push(`${b.getAttribute("Id")??"(no Id)"}: adding a <${b.tagName}> to an existing group isn't supported — Command Bar Studio shows it read-only.`);return}const a=Y(o);if(!a)return V(`Group ${n}`,e.getAttribute("Location")??"");const p=Se(t,s);if(!p)return l.push(`Group ${n}: couldn't read the <Group>.`);ee(a.tab.groups,p),R(a.location,n),P(e.getAttribute("Id"),`${n}.CustomAction`),v=!0,S.push(`Added group ${p.label} (${n}) with ${p.buttons.length} control(s) to ${o} on ${a.location}`)},Xe=(e,t,o)=>{const s=t.getAttribute("Id");if(!s)return l.push(`CustomAction ${e.getAttribute("Id")}: the tab has no Id.`);if(Y(s))return l.push(`Tab ${s} already exists — it was left as is.`);const n=re(Q(t));if(!n)return l.push(`Tab ${s}: couldn't read the <Tab>.`);const u=n.tabDisplayRules.flatMap(D=>D.rules.map(Te=>Te.kind==="EntityRule"?rt(Te.context):void 0)),a=T?"Application":u.find(D=>!!D)??he.exec(s)?.[1]??I,b=Array.from(t.querySelectorAll(":scope > Groups > Group")).map(D=>Se(D,void 0)).filter(D=>!!D),y=$e(t);Z({id:s,source:y});const x={...n,label:B(y.titleToken,s),source:y,sequence:t.getAttribute("Sequence")===null?o??n.sequence:n.sequence,groups:b};ee(j[a].tabs,x),P(e.getAttribute("Id"),`${s}.CustomAction`),x.commandId&&(r.add(x.commandId),L.out.some(D=>D.id===x.commandId)||(L.out.push({id:x.commandId,enableRules:[],displayRules:[],actions:[]}),L.changedIds.push(x.commandId),A.push(`Tab ${s}: its Command ${x.commandId} has no CommandDefinition in the XML — an empty one was added.`))),v=!0,S.push(`Added tab ${x.label} (${s}) with ${b.length} group(s) to ${a}`),t.querySelector(":scope > Scaling > Scale")&&l.push(`Tab ${s}: its <Scale> steps weren't imported — CBS writes a default MaxSize for each group.`)},Ge=e=>{const t=e.getAttribute("Location")??"",o=K(t);if(o){const s=o.found.filter(n=>!n.button.hidden);for(const n of s)n.button.hidden=!0;s.length>0?(R(o.location,t),P(e.getAttribute("HideActionId"),`${t}.HideAction`),v=!0,S.push(`Hid ${s[0].button.label} (${t}) on ${o.location}`)):F++;return}if(J(t)||Y(t))return l.push(`Hiding ${t}: hiding whole groups or tabs isn't supported yet — hide their buttons.`);l.push(`Hiding ${t}: not found in the loaded ribbon (it may belong to another entity, or already be hidden by your customizations).`)},Be=e=>{const t=e.getAttribute("Id")??"(no Id)",o=e.getAttribute("Location")??"",s=e.getAttribute("Sequence"),n=s===null?void 0:parseInt(s,10),u=U(e.querySelector(":scope > CommandUIDefinition"))[0];if(!u)return l.push(`CustomAction ${t}: no <CommandUIDefinition> content.`);const a=u.tagName;if(o.endsWith(Ie)){const p=o.slice(0,-Ie.length);return p.endsWith(".Controls")&&pe.has(a)?Ce(e,u,p.slice(0,-9),n):p.endsWith(".Groups")&&a==="Group"?ke(e,u,p.slice(0,-7),n):p==="Mscrm.Tabs"&&a==="Tab"?Xe(e,u,n):p.endsWith(".Scaling")&&(a==="MaxSize"||a==="Scale")?l.push(`CustomAction ${t}: <${a}> scaling isn't imported — CBS writes a default MaxSize for each new group.`):l.push(`CustomAction ${t}: a <${a}> at "${o}" isn't supported.`)}if(pe.has(a)&&u.getAttribute("Id")===o){if(we(o,u,n)){P(t,`${o}.Override.CustomAction`);return}return V(`Override ${t}`,o)}return K(o)||J(o)||Y(o)?l.push(`CustomAction ${t}: replacing ${o} with a <${a}> isn't supported — only overriding a control with the same Id is.`):V(`CustomAction ${t}`,o)},Me=U($.querySelector(":scope > CustomActions"));for(const e of Me)e.tagName==="CustomAction"?Be(e):e.tagName==="HideCustomAction"?Ge(e):l.push(`<${e.tagName}> in CustomActions isn't supported.`);const te=new Set;for(const e of ue)for(const t of j[e].tabs)for(const o of t.groups)for(const s of o.buttons)for(const n of We(s))te.add(n);for(const e of r)te.add(e);const le=new Set,ce=new Set;for(const e of L.out)if(te.has(e.id)){e.enableRules.forEach(t=>le.add(t)),e.displayRules.forEach(t=>ce.add(t));for(const t of e.rawRuleRefs??[]){const o=ot.exec(t.xml);o&&(o[1]==="EnableRule"?le:ce).add(o[2])}}const oe=(e,t,o,s)=>{for(const n of e)t.has(n)||l.push(`${o} ${n} was imported but ${s}, so it won't be published.`)};oe(L.changedIds,te,"Command","no button on the loaded ribbon uses it"),oe(z.changedIds,le,"Enable rule","no command a button uses references it"),oe(N.changedIds,ce,"Display rule","no command a button uses references it");const Re=new Set(Array.from(Q($).matchAll(fe),e=>e[1]));for(const e of ue)for(const t of j[e].tabs)for(const o of t.groups)for(const s of o.buttons)for(const n of Object.values(s.source?.attributes??{}))for(const u of n.matchAll(fe))Re.add(u[1]);oe(C.changedIds,Re,"Label","nothing references it");const qe=Array.from($.querySelectorAll(":scope > RuleDefinitions > TabDisplayRules > TabDisplayRule"));for(const e of qe){const t=e.getAttribute("TabCommand")??"";r.has(t)||l.push(`TabDisplayRule for ${t}: only the display rules of tabs this import adds are imported.`);const o=U(e).filter(s=>s.tagName!=="EntityRule"&&s.tagName!=="PageRule");o.length>0&&l.push(`TabDisplayRule for ${t}: ${o.map(s=>`<${s.tagName}>`).join(", ")} not imported — only EntityRule and PageRule are supported.`)}ie.length>0&&A.push(`Ids normalised: CBS publishes CustomAction / HideCustomAction ids as {control}.CustomAction, {control}.Override.CustomAction and {control}.HideAction, so ${ie.join(", ")} will be written under those ids.`),q+F>0&&S.push(`${q+F} control(s) / definition(s) were already up to date`);const He=v||L.changedIds.length+z.changedIds.length+N.changedIds.length+C.changedIds.length>0;return{ribbons:v?j:i.ribbons,commands:L.out,enableRules:z.out,displayRules:N.out,locLabels:k,applied:S,notApplied:l,notes:A,changed:He}}function lt(i,f){const d=Qe.getState(),m=at({xml:i,ribbons:d.ribbons,commands:d.commands,enableRules:d.enableRules,displayRules:d.displayRules,locLabels:d.locLabels,entityLogicalName:De.getState().activeEntity?.logicalName??d.ribbons.HomepageGrid.entityLogicalName,activeLocation:Ze.getState().location,languageCode:d.baseLanguageCode});return f&&m.changed&&d.applyImport(m,`${m.applied.length} change(s)`),m}const ct=Pe({content:{display:"grid",gridTemplateColumns:"1.4fr 1fr",gap:E.spacingHorizontalL,height:"min(560px, calc(100vh - 240px))",minHeight:"320px",overflowY:"hidden","@media (max-width: 760px)":{gridTemplateColumns:"1fr",gridTemplateRows:"minmax(240px, 1.4fr) 1fr",overflowY:"auto"}},editorColumn:{display:"flex",flexDirection:"column",gap:E.spacingVerticalXS,minHeight:0,minWidth:0},editor:{flex:1,minHeight:"200px",border:`1px solid ${E.colorNeutralStroke2}`,borderRadius:E.borderRadiusMedium,overflow:"hidden"},muted:{color:E.colorNeutralForeground3},results:{display:"flex",flexDirection:"column",gap:E.spacingVerticalM,minHeight:0,minWidth:0,overflowY:"auto",paddingRight:E.spacingHorizontalXS},section:{display:"flex",flexDirection:"column",gap:E.spacingVerticalXS},list:{listStyleType:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:E.spacingVerticalXS},row:{display:"flex",alignItems:"flex-start",gap:E.spacingHorizontalS,minWidth:0},rowBadge:{flexShrink:0,marginTop:"2px"},rowText:{minWidth:0,overflowWrap:"anywhere"},problemButton:{textAlign:"start",justifyContent:"flex-start",minWidth:0,height:"auto",padding:0,fontWeight:E.fontWeightRegular}});function be(i){return/^Added\b|\badded$/.test(i)?"Add":/^Updated\b|\bupdated$/.test(i)?"Update":/^Hid\b/.test(i)?"Hide":null}const dt={Add:"success",Update:"brand",Hide:"informative"};function ut(i,f,d){const m=i.map(h=>{const $=h.lineHint?Number(/\d+/.exec(h.lineHint)?.[0]):void 0;return{severity:h.severity==="warning"?"warning":"error",text:h.message,line:Number.isFinite($)?$:void 0}});d&&m.push({severity:"error",text:d});for(const h of f?.notApplied??[])m.push({severity:"warning",text:h});return m}const se=(i,f)=>`${i} ${f}${i===1?"":"s"}`,xt=()=>{const i=ct(),f=ne(r=>r.importXmlOpen),d=ne(r=>r.importXmlSeed),m=ne(r=>r.importXmlNote),h=ne(r=>r.closeImportXml),$=De(r=>r.activeEntity?.displayName??r.activeEntity?.logicalName),[w,G]=W.useState(""),[S,l]=W.useState([]),[A,O]=W.useState(null),[T,I]=W.useState(""),M=W.useRef(null);W.useEffect(()=>{f&&(G(d),l([]),O(null),I(""))},[f,d]);const H=r=>{G(r),A?.imported||(O(null),l([]),I(""))},L=r=>{const g=et(w);if(l(g),I(""),g.some(R=>R.severity!=="warning")){O(null);return}try{O({result:lt(w,r),imported:r})}catch(R){O(null),I(R instanceof Error?R.message:String(R))}},z=r=>{const g=M.current;g&&(g.revealLineInCenter(r),g.setPosition({lineNumber:r,column:1}),g.focus())},N=A?.imported===!0,C=A?.result,k=C?.applied??[],q=ut(S,C,T),B=q.some(r=>r.severity==="error"),j=!!C||S.length>0||!!T,v=C&&!N?k.filter(r=>be(r)).length:0,F=N?C.changed?`Imported ${se(k.filter(r=>be(r)).length,"change")}`:"Nothing to import: the session already has all of it":j?`Preview · ${se(v,"change")}, ${se(q.length,"problem")}`:"Preview";return c.jsxs(Ve,{open:f,onOpenChange:r=>!r&&h(),title:"Import RibbonDiffXml",size:"large",contentClassName:i.content,actions:N?c.jsx(_,{appearance:"primary",onClick:h,children:"Close"}):c.jsxs(c.Fragment,{children:[c.jsx(_,{onClick:h,children:"Cancel"}),c.jsx(_,{onClick:()=>L(!1),disabled:!w.trim(),children:j?"Preview again":"Preview"}),c.jsx(_,{appearance:"primary",onClick:()=>L(!0),disabled:!w.trim()||B,children:v>0?`Import ${se(v,"change")}`:"Import"})]}),children:[c.jsxs("div",{className:i.editorColumn,children:[c.jsx(X,{weight:"semibold",id:"import-xml-label",children:"Paste RibbonDiffXml"}),c.jsxs(de,{className:i.muted,children:["From Ribbon Workbench or a solution's customizations.xml. Only"," ",$??"this entity","'s part is used."]}),c.jsx("div",{className:i.editor,role:"group","aria-labelledby":"import-xml-label",children:c.jsx(tt,{language:"xml",value:w,onChange:H,readOnly:N,height:"100%",onMount:r=>{M.current=r},options:{wordWrap:"on",lineNumbers:"on",padding:{top:8}}})})]}),c.jsxs("section",{className:i.results,"aria-label":"Preview",children:[c.jsx(X,{weight:"semibold",role:"status",children:F}),!j&&c.jsxs(c.Fragment,{children:[m&&!w&&c.jsx(ze,{intent:"info",children:c.jsx(Fe,{children:m})}),c.jsx(X,{className:i.muted,children:"Preview shows what the import changes, and any problems, before anything changes. Commands, rules and labels are added or replaced by ID; buttons, groups and tabs are added to the ribbon; overrides and hides change the existing controls. The import is one change: Undo takes it all back."})]}),q.length>0&&c.jsxs("div",{className:i.section,children:[c.jsx(X,{weight:"semibold",children:"Problems"}),c.jsx("ul",{className:i.list,"aria-label":"Problems",children:q.map((r,g)=>c.jsxs("li",{className:i.row,children:[c.jsx(Ne,{className:i.rowBadge,size:"medium",appearance:"tint",color:r.severity==="error"?"danger":"warning",children:r.severity==="error"?"Error":"Warning"}),r.line?c.jsx(_,{appearance:"transparent",className:i.problemButton,onClick:()=>z(r.line),children:c.jsxs("span",{className:i.rowText,children:["Line ",r.line,": ",r.text]})}):c.jsx(X,{className:i.rowText,children:r.text})]},g))}),!B&&!N&&v>0&&C.notApplied.length>0&&c.jsx(de,{className:i.muted,children:"Warnings don't stop the import: they say what won't be imported or published."})]}),k.length>0&&c.jsxs("div",{className:i.section,children:[c.jsx(X,{weight:"semibold",children:N?"Imported":"Changes"}),c.jsx("ul",{className:i.list,"aria-label":"Changes",children:k.map((r,g)=>{const R=be(r);return c.jsxs("li",{className:i.row,children:[R&&c.jsx(Ne,{className:i.rowBadge,size:"medium",appearance:"tint",color:dt[R],children:R}),c.jsx(X,{className:i.rowText,children:r})]},g)})})]}),C&&C.notes.length>0&&c.jsxs("div",{className:i.section,children:[c.jsx(X,{weight:"semibold",children:"Good to know"}),c.jsx("ul",{className:i.list,children:C.notes.map((r,g)=>c.jsx("li",{children:c.jsx(X,{className:i.rowText,children:r})},g))})]}),N&&C.changed&&c.jsx(de,{className:i.muted,children:"Review the changes on the canvas, then publish. Undo takes the whole import back."})]})]})};export{xt as ImportXmlModal,xt as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./monacoSetup-BIq1zGyP.js","./monaco-cQE5XS3B.js","./fluent-ui-CQyNN9H3.js","./preload-helper-PPVm8Dsz.js","./monaco-DQA8g3bM.css"])))=>i.map(i=>d[i]);
2
- import{_ as s}from"./preload-helper-PPVm8Dsz.js";import{j as t,r as _,dY as u,W as f}from"./fluent-ui-CQyNN9H3.js";import{b as h}from"./index-D7TexD30.js";const x=f.lazy(()=>s(()=>import("./monacoSetup-BIq1zGyP.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(()=>s(()=>import("./monaco-cQE5XS3B.js").then(e=>e.i),__vite__mapDeps([1,2,3,4]),import.meta.url))),v=({language:e,value:a,onChange:r,readOnly:i=!1,height:m="100%",options:n={},onMount:d})=>{const p=h(o=>o.themeMode)==="dark"?"vs-dark":"vs",l={readOnly:i,minimap:{enabled:!1},wordWrap:e==="xml"?"on":"off",scrollBeyondLastLine:!1,automaticLayout:!0,...n},c=o=>{r&&o!==void 0&&r(o)};return t.jsx(_.Suspense,{fallback:t.jsx(u,{size:"medium",label:"Loading editor…"}),children:t.jsx(x,{height:m,language:e,value:a,theme:p,options:l,onChange:c,onMount:d})})};export{v as M};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./monacoSetup-BRltj-y7.js","./monaco-DzBcrxae.js","./fluent-ui-BThr2m8u.js","./preload-helper-PPVm8Dsz.js","./monaco-DQA8g3bM.css"])))=>i.map(i=>d[i]);
2
+ import{_ as s}from"./preload-helper-PPVm8Dsz.js";import{j as t,r as _,e5 as u,W as f}from"./fluent-ui-BThr2m8u.js";import{b as h}from"./index-Df9NSpg6.js";const x=f.lazy(()=>s(()=>import("./monacoSetup-BRltj-y7.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(()=>s(()=>import("./monaco-DzBcrxae.js").then(e=>e.i),__vite__mapDeps([1,2,3,4]),import.meta.url))),v=({language:e,value:a,onChange:r,readOnly:i=!1,height:m="100%",options:n={},onMount:d})=>{const p=h(o=>o.themeMode)==="dark"?"vs-dark":"vs",l={readOnly:i,minimap:{enabled:!1},wordWrap:e==="xml"?"on":"off",scrollBeyondLastLine:!1,automaticLayout:!0,...n},c=o=>{r&&o!==void 0&&r(o)};return t.jsx(_.Suspense,{fallback:t.jsx(u,{size:"medium",label:"Loading editor…"}),children:t.jsx(x,{height:m,language:e,value:a,theme:p,options:l,onChange:c,onMount:d})})};export{v as M};
@@ -0,0 +1 @@
1
+ import{r as v,j as e,af as G,ag as K,y as w,aA as _,aB as z,k as C}from"./fluent-ui-BThr2m8u.js";import{b as y,a as i,o as p,d as m,A as D,p as U,q as $,s as H,k as J}from"./index-Df9NSpg6.js";import"./preload-helper-PPVm8Dsz.js";import"./dnd-C19d6Mn0.js";const Z=()=>{const o=y(t=>t.newButtonGroupId),c=y(t=>t.closeNewButton),k=i(t=>t.createButton),N=i(t=>t.upsertCommand),R=i(t=>t.batch),A=p(t=>t.selectButtonInContext),E=m(t=>t.publisherPrefix),T=m(t=>t.activeSolution),n=p(t=>t.location),g=p(t=>t.tabId),L=m(t=>t.activeEntity),P=o!==null,[l,f]=v.useState("New Button"),[h,x]=v.useState("button"),F=()=>{if(!o||!n)return;const t=T?.publisherPrefix?.trim()||E?.trim()||"new",s=L?.logicalName??"global",r=i.getState().ribbons,M=i.getState().commands,I=new Set(M.map(a=>a.id));for(const a of Object.values(r))for(const b of a.tabs)for(const O of b.groups)for(const q of $(O))I.add(q.id);const{id:S,commandId:j}=H(t,s,n,l,I),d=r[n].tabs.find(a=>a.groups.some(b=>b.id===o))?.id??g;if(!r[n].tabs.some(a=>a.id===d)){J.getState().logError("canvas",`Could not add the button: group ${o} was not found.`),c();return}R(()=>{k({location:n,tabId:d,groupId:o,button:{id:S,label:l,kind:h,templateAlias:"o1",commandId:j,hidden:!1,oob:!1,custom:!0,managed:!1}}),N({id:j,enableRules:[],displayRules:[],actions:[]})}),A(n,d,o,S),f("New Button"),x("button"),c()},B=i(t=>o&&n?t.ribbons[n].tabs.find(s=>s.groups.some(r=>r.id===o))?.id:void 0)??g,u=o&&n&&B?U(n,B,o):void 0;return e.jsxs(D,{open:P,onOpenChange:t=>!t&&c(),size:"small",title:"New button",actions:e.jsxs(e.Fragment,{children:[e.jsx(C,{appearance:"secondary",onClick:c,children:"Cancel"}),e.jsx(C,{appearance:"primary",onClick:F,disabled:!l.trim()||!!u,children:"Create button"})]}),children:[u&&e.jsx(G,{intent:"warning",children:e.jsx(K,{children:u})}),e.jsx(w,{label:"Label",required:!0,hint:"A command is created with it; edit it in the command editor.",children:e.jsx(_,{value:l,onChange:(t,s)=>f(s.value),"data-autofocus":!0})}),e.jsx(w,{label:"Kind",children:e.jsxs(z,{value:h,onChange:(t,s)=>x(s.value),children:[e.jsx("option",{value:"button",children:"Button"}),e.jsx("option",{value:"flyout",children:"Flyout"}),e.jsx("option",{value:"splitButton",children:"Split button"})]})})]})};export{Z as NewButtonModal,Z as default};
@@ -0,0 +1 @@
1
+ import{r as d,j as a,af as G,ag as T,y as m,aA as f,aB as v,k as h}from"./fluent-ui-BThr2m8u.js";import{b,a as C,o as x,A as M,P as S,t as A}from"./index-Df9NSpg6.js";import"./preload-helper-PPVm8Dsz.js";import"./dnd-C19d6Mn0.js";const c="Mscrm.Templates.Flexible2",I=()=>{const g=b(e=>e.newGroupOpen),s=b(e=>e.closeNewGroup),j=C(e=>e.createGroup),t=x(e=>e.location),o=x(e=>e.tabId),[r,i]=d.useState("New Group"),[p,u]=d.useState(c),w=()=>{!t||!o||(j({location:t,tabId:o,group:{label:r,template:p,buttons:[]}}),i("New Group"),u(c),s())},n=t&&o?A(t,o):void 0;return a.jsxs(M,{open:g,onOpenChange:e=>!e&&s(),size:"small",title:"New group",actions:a.jsxs(a.Fragment,{children:[a.jsx(h,{appearance:"secondary",onClick:s,children:"Cancel"}),a.jsx(h,{appearance:"primary",onClick:w,disabled:!r.trim()||!!n,children:"Create group"})]}),children:[n&&a.jsx(G,{intent:"warning",children:a.jsx(T,{children:n})}),a.jsx(m,{label:"Label",required:!0,children:a.jsx(f,{value:r,onChange:(e,l)=>i(l.value),"data-autofocus":!0})}),a.jsx(m,{label:"Group template",hint:"How the group's buttons shrink when the classic ribbon is narrow. Unified Interface ignores it.",children:a.jsx(v,{value:p,onChange:(e,l)=>u(l.value),children:S.map(e=>a.jsxs("option",{value:e,children:[e.replace(/^Mscrm\.Templates\./,""),e===c?" (recommended)":""]},e))})})]})};export{I as NewGroupModal,I as default};
@@ -0,0 +1 @@
1
+ import{r as I,W as D,j as a,y as x,aA as T,I as M,k as f,m as O,t as _}from"./fluent-ui-BThr2m8u.js";import{o as L,a as l,d as w,b as v,v as R,x as U,y as z,A as F,I as $,U as H}from"./index-Df9NSpg6.js";import"./preload-helper-PPVm8Dsz.js";import"./dnd-C19d6Mn0.js";const j={HomepageGrid:"home grid",Form:"form",SubGrid:"sub-grid",Application:""},B=O({body:{display:"flex",flexDirection:"column",gap:_.spacingHorizontalM}}),Z=()=>{const N=B(),[o,b]=I.useState("New Tab"),[d,u]=I.useState(""),s=L(e=>e.location),S=l(e=>e.createTab),i=l(e=>e.ribbons),p=l(e=>e.baseline),h=l(e=>e.layers),A=w(e=>e.activeEntity);w(e=>e.publisherPrefix);const C=v(e=>e.newTabOpen),r=v(e=>e.closeNewTab),m=D.useMemo(()=>R({baseline:p,layers:h},i),[p,h,i]),k=s==="Application"?"global":A?.logicalName??i[s].entityLogicalName,g=U(k,`${s}.${o}`,"Tab",m),t=d.trim(),n=t?z(t)??(/[^a-zA-Z0-9._]/.test(t)?"Use letters, digits, dots and underscores only":m.has(t)?"This ID is already used":null):null,y=t||g,E=()=>{n||(S(s,{id:y,label:o,tabDisplayRules:[],groups:[]}),b("New Tab"),u(""),r())};return a.jsx(F,{open:C,onOpenChange:e=>!e&&r(),size:"small",title:s==="Application"?"New tab":`New tab on the ${j[s]}`,actions:a.jsxs(a.Fragment,{children:[a.jsx(f,{appearance:"secondary",onClick:r,children:"Cancel"}),a.jsx(f,{appearance:"primary",disabled:!o.trim()||!!n,onClick:E,children:"Create tab"})]}),children:a.jsxs("div",{className:N.body,children:[a.jsx(x,{label:"Tab label",required:!0,hint:s==="Application"?"A tab shows only where a tab rule allows it: add one in Tab rules before publishing.":`It gets a tab rule for this entity's ${j[s]}; change it in Tab rules.`,children:a.jsx(T,{value:o,onChange:(e,c)=>b(c.value),placeholder:"My Tab","data-autofocus":!0})}),a.jsx(x,{label:"Tab ID",hint:"Leave blank to generate one from the label.",validationState:n?"error":"none",validationMessage:n??void 0,children:a.jsx(T,{value:d,onChange:(e,c)=>u(c.value),placeholder:g})}),a.jsx($,{label:"ID it gets",value:y}),a.jsx(M,{size:"small",info:H,children:"How Unified Interface shows a new tab"})]})})};export{Z as NewTabModal,Z as default};
@@ -0,0 +1 @@
1
+ import{r as B,dN as re,j as a,dZ as ie,I as H,z as A,k as F,m as G,t as u,W as oe,c as _,B as ce,T as ue,l as de,y as b,eZ as D,aA as S,C as pe,d as he,aB as me,P as Y,s as Z,aC as Q,x as J,ei as ge,af as xe,ag as ye,Y as be,Z as ve,dM as fe,a0 as Re,a1 as Ce,a4 as U,cN as je,cL as Se,dL as Ne}from"./fluent-ui-BThr2m8u.js";import{ab as Te,ac as $e,ad as W,b as V,a as L,ae as Oe,q as Ee}from"./index-Df9NSpg6.js";import{C as ke}from"./CrmParameterEditor-DfZv5BuF.js";import{u as we}from"./useStableKeys-EsghhjoV.js";import{D as Ie,c as Pe,S as Ae,v as De,f as Me,C as Fe,g as Le}from"./dnd-C19d6Mn0.js";import"./preload-helper-PPVm8Dsz.js";import"./crmParameters-Dxz06tk4.js";const Ve=G({root:{display:"flex",flexDirection:"column",gap:u.spacingVerticalXS},searchRow:{display:"flex",alignItems:"center",gap:u.spacingHorizontalS,marginBottom:u.spacingVerticalXS},search:{flex:1,minWidth:0},group:{display:"flex",flexDirection:"column",gap:u.spacingVerticalXXS},groupLabel:{color:u.colorNeutralForeground3,fontWeight:u.fontWeightSemibold,paddingTop:u.spacingVerticalXS},kindButton:{justifyContent:"flex-start",textAlign:"left"}});function _e(e){switch(e){case"CommandClientTypeRule":return{kind:e,type:"Modern"};case"CrmClientTypeRule":return{kind:e,type:"Web"};case"FormStateRule":return{kind:e,state:"Existing"};case"FormTypeRule":return{kind:e,type:"Main"};case"SelectionCountRule":return{kind:e,minimum:1};case"EntityRule":return{kind:e};case"CustomRule":return{kind:e,library:"$webresource:",functionName:""};case"ValueRule":return{kind:e,field:"",value:""};case"SkuRule":return{kind:e,sku:"Online"};case"OrRule":return{kind:e,groups:[[{kind:"FormStateRule",state:"Existing"}],[{kind:"FormStateRule",state:"Create"}]]};case"FeatureControlRule":return{kind:e,featureControlBit:"",expectedValue:!0};case"OrganizationSettingRule":return{kind:e,setting:"IsSharepointEnabled"};case"EntityPrivilegeRule":return{kind:e,privilegeType:"Read",privilegeDepth:"Basic"};case"EntityPropertyRule":return{kind:e,propertyName:"IsCustomizable",propertyValue:!0};case"RecordPrivilegeRule":return{kind:e,privilegeType:"Read"};case"RelationshipTypeRule":return{kind:e,appliesTo:"SelectedEntity"};case"MiscellaneousPrivilegeRule":return{kind:e,privilegeName:"ExportToExcel"};case"FormEntityContextRule":return{kind:e,entityName:""};case"PageRule":return{kind:e,address:""};case"CrmOfflineAccessStateRule":return{kind:e,state:"Online"};case"CrmOutlookClientTypeRule":return{kind:e,type:"CrmForOutlook"};case"CrmOutlookClientVersionRule":return{kind:e,major:15,minor:0,build:0,revision:0};case"DeviceTypeRule":return{kind:e,type:"Web"};case"OptionSetRule":return{kind:e,optionSet:"",stateCode:"",objectTypeCode:""};case"OutlookItemTrackingRule":return{kind:e,trackedInCrm:!0};case"OutlookRenderTypeRule":return{kind:e,type:"Web"};case"OutlookVersionRule":return{kind:e,version:"2010"};case"HideForTabletExperienceRule":return{kind:e};case"ReferencingAttributeRequiredRule":return{kind:e};default:return{kind:e}}}const ee=({onSelect:e,container:s,insideOr:o=!1})=>{const c=Ve(),[h,f]=B.useState(""),i=re({axis:"vertical"}),x=[...new Set([h.toLowerCase(),h.toLowerCase().replace("table","entity")])],g=Te.map(m=>({...m,kinds:m.kinds.filter(y=>{if(s&&!$e(y,s,o)||o&&y==="OrRule")return!1;const E=(W[y]??y).toLowerCase();return!h||x.some(N=>E.includes(N)||y.toLowerCase().includes(N))})})).filter(m=>m.kinds.length>0);return a.jsxs("div",{className:c.root,children:[a.jsxs("div",{className:c.searchRow,children:[a.jsx(ie,{className:c.search,placeholder:"Search steps","aria-label":"Search steps",value:h,onChange:(m,y)=>f(y.value)}),a.jsx(H,{info:"Show on grid or quick action comes from Microsoft's rules (Mscrm.ShowOnGrid, Mscrm.ShowOnQuickAction): bind them in the command's Enable rules, under Microsoft's grid rules.",children:a.jsx("span",{className:c.groupLabel,children:"Not here?"})})]}),a.jsxs("div",{role:"group","aria-label":"Kinds of step",...i,children:[g.map(m=>a.jsxs("div",{className:c.group,children:[a.jsx(A,{className:c.groupLabel,children:m.label}),m.kinds.map(y=>a.jsx(F,{appearance:"subtle",className:c.kindButton,onClick:()=>e(_e(y)),children:W[y]??y},y))]},m.label)),g.length===0&&a.jsx(A,{children:"No kind of step matches."})]})]})},ae=G({step:{display:"flex",flexDirection:"column",minWidth:0,gap:u.spacingVerticalXS,padding:u.spacingVerticalS,border:`1px solid ${u.colorNeutralStroke2}`,borderRadius:u.borderRadiusMedium,backgroundColor:u.colorNeutralBackground2},header:{display:"flex",alignItems:"center",gap:u.spacingHorizontalXS},title:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:u.spacingHorizontalXS},kindBadge:{flexShrink:0},fields:{display:"flex",flexDirection:"column",gap:u.spacingVerticalXS,minWidth:0},row:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:u.spacingHorizontalS,alignItems:"end",minWidth:0,"& > *":{minWidth:0,gridTemplateColumns:"minmax(0, 1fr)"},"& select":{minWidth:0}},number:{maxWidth:"140px"},muted:{color:u.colorNeutralForeground3},nested:{display:"flex",flexDirection:"column",gap:u.spacingVerticalXS,paddingLeft:u.spacingHorizontalM,borderLeft:`2px solid ${u.colorBrandStroke2}`},nestedToolbar:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:u.spacingHorizontalXS},pickerSurface:{minWidth:"300px",maxHeight:"50vh",overflowY:"auto",padding:u.spacingVerticalS}}),X=e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/^Is /,"").toLowerCase().replace(/^./,s=>s.toUpperCase()),P=[["PrimaryEntity","Primary entity (the form or grid)"],["SelectedEntity","Selected records"]],Be=[["Form","Form"],["HomePageGrid","Home page grid"],["SubGridStandard","Sub-grid"],["SubGridAssociated","Associated grid"]],We=[["Create","New record"],["Existing","Existing record"],["ReadOnly","Read-only"],["Disabled","Disabled"],["BulkEdit","Bulk edit"]],ze=[["Main","Main"],["Preview","Preview"],["AppointmentBook","Appointment book"],["Dashboard","Dashboard"],["Quick","Quick view"],["QuickCreate","Quick create"],["Card","Card"],["MainInteractionCentric","Main (interactive experience)"]],He=[["None","None"],["Phone","Phone"],["Tablet","Tablet"],["Web","Web"],["Outlook","Outlook"],["InteractionCentric","Interactive experience"]],K=[["Create","Create"],["Read","Read"],["Write","Write"],["Delete","Delete"],["Assign","Assign"],["Share","Share"],["Append","Append"],["AppendTo","Append to"]],q=[["None","None"],["Basic","User (Basic)"],["Local","Business unit (Local)"],["Deep","Parent: child business units (Deep)"],["Global","Organization (Global)"]],Ge=["DuplicateDetectionEnabled","GridFiltersEnabled","HasStateCode","IsConnectionsEnabled","MailMergeEnabled","WorksWithQueue","HasActivities","IsActivity","HasNotes","IsCustomizable","IsActivityParty","HasEmailAddresses","IsChildEntity","IsImportable","IsEnabledForCharts","IsBusinessProcessEnabled","HasFeedback","IsBPFEntity"],Ue=["IsSharepointEnabled","IsSOPIntegrationEnabled","IsFiscalCalendarDefined","IsReadFormModeDefined","IsBPFEntityCustomizationFeatureEnabled"],Xe=["ExportToExcel","MailMerge","GoOffline","OfflineSynchronize","PublishReports"];function p({label:e,info:s,value:o,choices:c,anyLabel:h,disabled:f,onChange:i}){return a.jsx(b,{label:s?{children:(x,g)=>a.jsx(H,{...g,info:s,children:e})}:e,children:a.jsxs(me,{value:o??"",disabled:f,onChange:(x,g)=>i(g.value||void 0),children:[h!==void 0&&a.jsx("option",{value:"",children:h}),c.map(([x,g])=>a.jsx("option",{value:x,children:g},x))]})})}function M({label:e,value:s,required:o,min:c=0,onChange:h}){const f=ae();return a.jsx(b,{label:e,children:a.jsx(ge,{className:f.number,min:c,value:s??null,onChange:(i,x)=>{const g=x.displayValue?.trim(),m=x.value!==void 0&&x.value!==null?x.value:g?parseInt(g,10):void 0;if(m===void 0)return o?void 0:h(void 0);Number.isInteger(m)&&m>=c&&h(m)}})})}const ne=({step:e,onChange:s,onRemove:o,container:c,number:h,menu:f})=>{const i=ae(),[x,g]=oe.useState(null),m=e.kind!=="OrRule"&&e.kind!=="RawRule",y=m?e.invertResult:void 0,E=m?e.default:void 0,N=W[e.kind]??e.kind,l=n=>{s({...e,...n})},O=(n,r)=>a.jsx(b,{label:"Entity",hint:"Its logical name; empty for any.",children:a.jsx(S,{value:n??"",onChange:(R,v)=>r(v.value||void 0)})}),k=()=>{switch(e.kind){case"CommandClientTypeRule":return a.jsx(p,{label:"Client",value:e.type,choices:[["Modern","Modern (Unified Interface: web, tablets and phones)"],["Refresh","Refresh (legacy updated web client)"],["Legacy","Legacy (classic ribbon + Outlook list views)"]],onChange:n=>l({type:n})});case"CrmClientTypeRule":return a.jsx(p,{label:"Client",value:e.type,choices:[["Web","Web"],["Outlook","Outlook"]],onChange:n=>l({type:n})});case"FormStateRule":return a.jsx(p,{label:"State",value:e.state,choices:We,onChange:n=>l({state:n})});case"FormTypeRule":return a.jsx(p,{label:"Form type",value:e.type,choices:ze,onChange:n=>l({type:n})});case"SelectionCountRule":return a.jsxs("div",{className:i.row,children:[a.jsx(M,{label:"At least",value:e.minimum,onChange:n=>l({minimum:n})}),a.jsx(M,{label:"At most",value:e.maximum,onChange:n=>l({maximum:n})}),a.jsx(p,{label:"Applies to",value:e.appliesTo,choices:P,anyLabel:"Any",onChange:n=>l({appliesTo:n})})]});case"EntityRule":return a.jsxs("div",{className:i.row,children:[O(e.entityName,n=>l({entityName:n})),a.jsx(p,{label:"Applies to",value:e.appliesTo,choices:P,anyLabel:"Any",onChange:n=>l({appliesTo:n})}),a.jsx(p,{label:"Where",value:e.context,choices:Be,anyLabel:"Anywhere",onChange:n=>l({context:n})})]});case"FormEntityContextRule":return a.jsx(b,{label:"The form's entity",hint:"Its logical name.",children:a.jsx(S,{value:e.entityName,onChange:(n,r)=>l({entityName:r.value})})});case"CustomRule":return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:i.row,children:[a.jsx(b,{label:"Library",hint:"A JavaScript web resource ($webresource:…).",children:a.jsx(S,{value:e.library,onChange:(n,r)=>l({library:r.value}),placeholder:"$webresource:publisher_/scripts/file.js"})}),a.jsx(b,{label:"Function",hint:"The function's full name, including its namespace.",children:a.jsx(S,{value:e.functionName,onChange:(n,r)=>l({functionName:r.value})})})]}),a.jsx(b,{label:"Parameters, in order",children:a.jsx(ke,{params:e.params??[],onChange:n=>l({params:n.length?n:void 0})})}),a.jsx(A,{className:i.muted,children:"In Unified Interface the function can return a Promise of true or false; one that hasn't settled after 10 seconds counts as false."})]});case"CrmOfflineAccessStateRule":return a.jsx(p,{label:"State",value:e.state,choices:[["Online","Online"],["Offline","Offline"]],onChange:n=>l({state:n})});case"CrmOutlookClientTypeRule":return a.jsx(p,{label:"Outlook client",value:e.type,choices:[["CrmForOutlook","Outlook"],["CrmForOutlookOfflineAccess","Outlook with offline access"]],onChange:n=>l({type:n})});case"CrmOutlookClientVersionRule":return a.jsxs("div",{className:i.row,children:[a.jsx(M,{label:"Major",value:e.major,required:!0,onChange:n=>n!==void 0&&l({major:n})}),a.jsx(M,{label:"Minor",value:e.minor,onChange:n=>l({minor:n})}),a.jsx(M,{label:"Build",value:e.build,onChange:n=>l({build:n})}),a.jsx(M,{label:"Revision",value:e.revision,onChange:n=>l({revision:n})})]});case"DeviceTypeRule":return a.jsx(p,{label:"Device",value:e.type,choices:He,onChange:n=>l({type:n})});case"EntityPrivilegeRule":return a.jsxs("div",{className:i.row,children:[O(e.entityName,n=>l({entityName:n})),a.jsx(p,{label:"Applies to",value:e.appliesTo,choices:P,anyLabel:"Any",onChange:n=>l({appliesTo:n})}),a.jsx(p,{label:"Privilege",value:e.privilegeType,choices:K,onChange:n=>l({privilegeType:n})}),a.jsx(p,{label:"Depth",value:e.privilegeDepth,choices:q,onChange:n=>l({privilegeDepth:n})})]});case"EntityPropertyRule":return a.jsxs("div",{className:i.row,children:[O(e.entityName,n=>l({entityName:n})),a.jsx(p,{label:"Applies to",value:e.appliesTo,choices:P,anyLabel:"Any",onChange:n=>l({appliesTo:n})}),a.jsx(p,{label:"Property",value:e.propertyName,choices:Ge.map(n=>[n,X(n)]),onChange:n=>l({propertyName:n})}),a.jsx(D,{label:"The property is true",checked:e.propertyValue,onChange:(n,r)=>l({propertyValue:r.checked===!0})})]});case"ValueRule":return a.jsxs("div",{className:i.row,children:[a.jsx(b,{label:"Column",hint:"Its logical name.",children:a.jsx(S,{value:e.field,onChange:(n,r)=>l({field:r.value})})}),a.jsx(b,{label:"Equals",children:a.jsx(S,{value:e.value,onChange:(n,r)=>l({value:r.value})})})]});case"OrRule":{const n=R=>s({...e,groups:R.filter(v=>v.length>0)}),r=(R,v)=>a.jsxs(Y,{open:x===R,onOpenChange:(T,$)=>g($.open?R:null),positioning:"below-start",children:[a.jsx(Z,{children:a.jsx(F,{icon:a.jsx(Q,{}),appearance:"secondary",size:"small",children:v})}),a.jsx(J,{className:i.pickerSurface,children:a.jsx(ee,{container:c,insideOr:!0,onSelect:T=>{n(R==="new"?[...e.groups,[T]]:e.groups.map(($,C)=>C===R?[...$,T]:$)),g(null)}})})]});return a.jsxs("div",{className:i.nested,children:[e.groups.map((R,v)=>a.jsxs("div",{className:i.nested,children:[a.jsxs(_,{size:200,weight:"semibold",children:[v===0?"Either":"Or",R.length>1?" (all of)":""]}),R.map((T,$)=>a.jsx(ne,{step:T,container:c,onChange:C=>n(e.groups.map((w,t)=>t===v?w.map((d,j)=>j===$?C:d):w)),onRemove:()=>n(e.groups.map((C,w)=>w===v?C.filter((t,d)=>d!==$):C))},`${v}-${$}-${T.kind}`)),a.jsx("div",{className:i.nestedToolbar,children:r(v,"And…")})]},v)),a.jsxs("div",{className:i.nestedToolbar,children:[r("new","Add an Or branch"),a.jsx(A,{className:i.muted,children:"An Or needs at least two branches."})]})]})}case"FeatureControlRule":return a.jsxs("div",{className:i.row,children:[a.jsx(b,{label:"Feature control bit",children:a.jsx(S,{value:e.featureControlBit,onChange:(n,r)=>l({featureControlBit:r.value})})}),a.jsx(D,{label:"The bit is set",checked:e.expectedValue,onChange:(n,r)=>l({expectedValue:r.checked===!0})})]});case"RawRule":return a.jsxs(a.Fragment,{children:[a.jsx(A,{className:i.muted,children:"Command Bar Studio doesn't edit this rule; it is kept exactly as loaded."}),a.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",fontSize:"11px"},children:e.xml})]});case"SkuRule":return a.jsx(p,{label:"Deployment",value:e.sku,choices:[["Online","Online"],["OnPremise","On-premises"],["Spla","Hosted (SPLA)"]],onChange:n=>l({sku:n})});case"OrganizationSettingRule":return a.jsx(p,{label:"Setting is on",value:e.setting,choices:Ue.map(n=>[n,X(n)]),onChange:n=>l({setting:n})});case"MiscellaneousPrivilegeRule":return a.jsxs("div",{className:i.row,children:[a.jsx(b,{label:"Privilege",children:a.jsx(pe,{freeform:!0,value:e.privilegeName,placeholder:"ExportToExcel",onChange:n=>l({privilegeName:n.target.value}),onOptionSelect:(n,r)=>r.optionValue&&l({privilegeName:r.optionValue}),children:Xe.map(n=>a.jsx(he,{value:n,children:n},n))})}),a.jsx(p,{label:"Depth",value:e.privilegeDepth,choices:q,anyLabel:"Any",onChange:n=>l({privilegeDepth:n})})]});case"OptionSetRule":return a.jsxs("div",{className:i.row,children:[a.jsx(b,{label:"Choice column",children:a.jsx(S,{value:e.optionSet,onChange:(n,r)=>l({optionSet:r.value})})}),a.jsx(b,{label:"State code",children:a.jsx(S,{value:e.stateCode,onChange:(n,r)=>l({stateCode:r.value})})}),a.jsx(b,{label:"Entity type code",children:a.jsx(S,{value:e.objectTypeCode,onChange:(n,r)=>l({objectTypeCode:r.value})})})]});case"OutlookItemTrackingRule":return a.jsxs("div",{className:i.row,children:[a.jsx(D,{label:"The item is tracked",checked:e.trackedInCrm,onChange:(n,r)=>l({trackedInCrm:r.checked===!0})}),a.jsx(p,{label:"Applies to",value:e.appliesTo??"PrimaryEntity",choices:P.slice(0,1),onChange:n=>l({appliesTo:n})})]});case"OutlookRenderTypeRule":return a.jsx(p,{label:"Shown in",value:e.type,choices:[["Web","Web"],["Outlook","Outlook"]],onChange:n=>l({type:n})});case"OutlookVersionRule":return a.jsx(p,{label:"Outlook version",value:e.version,choices:[["2003","2003"],["2007","2007"],["2010","2010"]],onChange:n=>l({version:n})});case"PageRule":return a.jsx(b,{label:"Page address contains",children:a.jsx(S,{value:e.address,onChange:(n,r)=>l({address:r.value}),placeholder:"main.aspx"})});case"RecordPrivilegeRule":return a.jsxs("div",{className:i.row,children:[a.jsx(p,{label:"Privilege",value:e.privilegeType,choices:K,onChange:n=>l({privilegeType:n})}),a.jsx(p,{label:"Applies to",value:e.appliesTo,choices:P.slice(0,1),anyLabel:"The selected record",onChange:n=>l({appliesTo:n})})]});case"RelationshipTypeRule":return a.jsxs("div",{className:i.row,children:[a.jsx(p,{label:"Applies to",value:e.appliesTo,choices:P.slice(1),disabled:!0,onChange:()=>{}}),a.jsx(p,{label:"Relationship",value:e.relationshipType,choices:[["OneToMany","One-to-many"],["ManyToMany","Many-to-many"],["NoRelationship","No relationship"]],anyLabel:"Any",onChange:n=>l({relationshipType:n})}),a.jsx(D,{label:"Custom relationships too",checked:e.allowCustomRelationship===!0,onChange:(n,r)=>l({allowCustomRelationship:r.checked===!0})}),a.jsx(D,{label:"System relationships too",checked:e.allowSystemRelationship===!0,onChange:(n,r)=>l({allowSystemRelationship:r.checked===!0})})]});default:return a.jsx(A,{className:i.muted,children:"Nothing to set for this step."})}};return a.jsxs("div",{className:i.step,children:[a.jsxs("div",{className:i.header,children:[a.jsxs("div",{className:i.title,children:[h!==void 0&&a.jsxs(_,{weight:"semibold",children:[h,"."]}),a.jsx(ce,{appearance:"outline",size:"medium",className:i.kindBadge,children:N})]}),f,a.jsx(ue,{content:`Remove ${N} step`,relationship:"label",children:a.jsx(F,{appearance:"subtle",icon:a.jsx(de,{}),size:"small",onClick:o})})]}),a.jsxs("div",{className:i.fields,children:[k(),m&&a.jsxs("div",{className:i.row,children:[a.jsx(p,{label:"If it can't be evaluated",info:"What the step counts as when it can't be evaluated.",value:E===void 0?void 0:String(E),choices:[["true","Passes"],["false","Fails"]],anyLabel:"Not set",onChange:n=>l({default:n===void 0?void 0:n==="true"})}),a.jsx(b,{hint:"The step passes when its condition is false.",children:a.jsx(D,{label:"Invert result",checked:y===!0,onChange:(n,r)=>l({invertResult:r.checked===!0?!0:void 0})})})]})]})]})};function Ke(e){return e.length===0?"No steps defined — a rule needs at least one before it can be published.":e.map(z).join(" AND ")}function z(e){const s="invertResult"in e&&e.invertResult?"NOT ":"";switch(e.kind){case"SelectionCountRule":{const o=e.minimum!==void 0?`at least ${e.minimum}`:null,c=e.maximum!==void 0?`at most ${e.maximum}`:null,h=[o,c].filter(Boolean).join(" and "),f=e.appliesTo?` (${e.appliesTo})`:"";return`${s}Selection count is ${h}${f}`}case"EntityRule":{const o=e.entityName??"any entity",c=e.context?` in ${e.context} context`:"",h=e.appliesTo?` (${e.appliesTo})`:"";return`${s}Entity is "${o}"${c}${h}`}case"FormStateRule":return`${s}Form state is "${e.state}"`;case"CommandClientTypeRule":return`${s}Client type is "${e.type}" (${qe(e.type)})`;case"CrmClientTypeRule":return`${s}CRM client type is "${e.type}"`;case"CustomRule":return`${s}Custom rule: ${e.functionName}() from ${e.library}`;case"OrRule":return`(${e.groups.map(c=>c.length===1?z(c[0]):`(${c.map(z).join(" AND ")})`).join(" OR ")})`;case"FeatureControlRule":return`${s}Feature "${e.featureControlBit}" is ${e.expectedValue?"on":"off"}`;case"RawRule":return`${e.tagName} (kept as XML)`;case"MiscellaneousPrivilegeRule":{const o=e.privilegeDepth?` at ${e.privilegeDepth} depth`:"";return`${s}User has "${e.privilegeName}" privilege${o}`}case"EntityPrivilegeRule":{const o=e.entityName?` on "${e.entityName}"`:"",c=e.appliesTo?` (${e.appliesTo})`:"";return`${s}User has ${e.privilegeType} privilege${o} at ${e.privilegeDepth} depth${c}`}case"EntityPropertyRule":{const o=e.entityName?` for "${e.entityName}"`:"";return`${s}Entity property "${e.propertyName}" is ${e.propertyValue}${o}`}case"FormTypeRule":return`${s}Form type is "${e.type}"`;case"FormEntityContextRule":return`${s}Form entity context is "${e.entityName}"`;case"ValueRule":return`${s}Field "${e.field}" equals "${e.value}"`;case"SkuRule":return`${s}SKU is "${e.sku}"`;case"HideForTabletExperienceRule":return`${s}Hide for tablet experience`;case"OrganizationSettingRule":return`${s}Organization setting "${e.setting}" is enabled`;case"PageRule":return`${s}Page address matches "${e.address}"`;case"RecordPrivilegeRule":{const o=e.appliesTo?` (${e.appliesTo})`:"";return`${s}User has ${e.privilegeType} privilege on current record${o}`}case"RelationshipTypeRule":{const o=e.relationshipType??"any";return`${s}Relationship type is "${o}" (${e.appliesTo})`}case"ReferencingAttributeRequiredRule":return`${s}Referencing attribute is required`;case"OutlookItemTrackingRule":return`${s}Outlook item is ${e.trackedInCrm?"":"not "}tracked in CRM`;case"OutlookRenderTypeRule":return`${s}Outlook render type is "${e.type}"`;case"OutlookVersionRule":return`${s}Outlook version is "${e.version}"`;case"CrmOfflineAccessStateRule":return`${s}CRM offline state is "${e.state}"`;case"CrmOutlookClientTypeRule":return`${s}CRM Outlook client type is "${e.type}"`;case"CrmOutlookClientVersionRule":return`${s}CRM Outlook client version is ${e.major}.${e.minor??0}+`;case"DeviceTypeRule":return`${s}Device type is "${e.type}"`;case"OptionSetRule":return`${s}Option set "${e.optionSet}" state code is "${e.stateCode}"`;default:return"Unknown rule step"}}function qe(e){switch(e){case"Modern":return"Unified Interface";case"Refresh":return"legacy updated web client";case"Legacy":return"Classic ribbon / Outlook list views";default:return e}}const le=G({body:{display:"flex",flexDirection:"column",gap:u.spacingVerticalM,minWidth:0},stepsList:{display:"flex",flexDirection:"column",gap:u.spacingVerticalS,listStyle:"none",padding:0,margin:0},muted:{color:u.colorNeutralForeground3},summary:{padding:u.spacingVerticalS,backgroundColor:u.colorNeutralBackground3,borderRadius:u.borderRadiusMedium,color:u.colorNeutralForeground2,fontSize:u.fontSizeBase200},pickerPopover:{maxHeight:"60vh",overflowY:"auto",minWidth:"320px",padding:u.spacingVerticalM},sortableInner:{display:"flex",alignItems:"flex-start",gap:u.spacingHorizontalXS,minWidth:0},dragHandle:{marginTop:u.spacingVerticalXS,cursor:"grab",touchAction:"none"},stepBody:{flex:1,minWidth:0}}),Ye=[],sa=()=>{const e=le(),s=V(t=>t.ruleEditorOpen),o=V(t=>t.ruleEditorId),c=V(t=>t.ruleEditorKind),h=V(t=>t.closeRuleEditor),f=L(t=>t.enableRules),i=L(t=>t.displayRules),x=L(t=>t.upsertEnableRule),g=L(t=>t.upsertDisplayRule),m=L(t=>{if(c!=="display"||!o)return!1;const d=t.displayRules.find(I=>I.id===o);if(!d||!Oe(d.steps,"ValueRule"))return!1;const j=new Set(t.commands.filter(I=>I.displayRules.includes(o)).map(I=>I.id));return j.size>0&&t.ribbons.SubGrid.tabs.some(I=>I.groups.some(te=>Ee(te).some(se=>j.has(se.commandId??""))))}),[y,E]=B.useState(!1),N=c==="enable",l=N?f.find(t=>t.id===o):i.find(t=>t.id===o);B.useEffect(()=>{s&&o&&!l&&h()},[s,o,l,h]);const O=we(`${c}:${l?.id??""}`,l?.steps??Ye),k=O.keys;if(!l)return null;const n=t=>{N?x({...l,steps:t}):g({...l,steps:t})},r=(t,d)=>{const j=[...l.steps];j[t]=d,O.update(),n(j)},R=t=>{O.remove(t),n(l.steps.filter((d,j)=>j!==t))},v=t=>{O.add(),n([...l.steps,t]),E(!1)},T=(t,d)=>{t===d||t<0||d<0||d>=l.steps.length||(O.move(t,d),n(Le(l.steps,t,d)))},$=t=>{t.over&&T(k.indexOf(String(t.active.id)),k.indexOf(String(t.over.id)))},C=l.steps.length,w=N?"enable":"display";return a.jsxs("div",{className:e.body,children:[N?a.jsx(H,{info:"Enable rules take fewer kinds of step than display rules; Add step only offers the ones they take.",children:"Passes when every step below is true."}):a.jsx(_,{children:"Passes when every step below is true."}),m&&a.jsx(xe,{intent:"warning",children:a.jsx(ye,{children:"A sub-grid button uses this rule, and on a form's sub-grid Unified Interface doesn't check a column value in a display rule. Put the Column value step in an enable rule instead."})}),C>0?a.jsx(Ie,{collisionDetection:Pe,onDragEnd:$,children:a.jsx(Ae,{items:k,strategy:De,children:a.jsx("ol",{className:e.stepsList,"aria-label":"Rule steps",children:l.steps.map((t,d)=>a.jsx(Ze,{id:k[d],draggable:C>1,children:a.jsx(ne,{step:t,number:d+1,menu:C>1&&a.jsxs(be,{children:[a.jsx(ve,{disableButtonEnhancement:!0,children:a.jsx(F,{appearance:"subtle",size:"small",icon:a.jsx(fe,{}),"aria-label":`More for step ${d+1}`})}),a.jsx(Re,{children:a.jsxs(Ce,{children:[a.jsx(U,{icon:a.jsx(je,{}),disabled:d===0,onClick:()=>T(d,d-1),children:"Move up"}),a.jsx(U,{icon:a.jsx(Se,{}),disabled:d===C-1,onClick:()=>T(d,d+1),children:"Move down"})]})})]}),onChange:j=>r(d,j),onRemove:()=>R(d),container:w})},k[d]))})})}):a.jsx(_,{className:e.muted,children:"No steps yet. A rule needs at least one step: add one before you publish, or remove the rule from its commands."}),a.jsx("div",{children:a.jsxs(Y,{open:y,onOpenChange:(t,d)=>E(d.open),positioning:"below-start",children:[a.jsx(Z,{children:a.jsx(F,{icon:a.jsx(Q,{}),onClick:()=>E(!0),children:"Add step"})}),a.jsx(J,{className:e.pickerPopover,children:a.jsx(ee,{onSelect:v,container:w})})]})}),C>0&&a.jsxs(a.Fragment,{children:[a.jsx(A,{className:e.muted,children:"In words"}),a.jsx("div",{className:e.summary,role:"note","aria-label":"Rule summary",children:Ke(l.steps)})]})]})};function Ze({id:e,draggable:s,children:o}){const c=le(),{attributes:h,listeners:f,setNodeRef:i,setActivatorNodeRef:x,transform:g,transition:m}=Me({id:e,disabled:!s});return a.jsx("li",{ref:i,style:{transform:Fe.Transform.toString(g),transition:m},children:a.jsxs("div",{className:c.sortableInner,children:[s&&a.jsx(F,{ref:x,appearance:"subtle",size:"small",className:c.dragHandle,icon:a.jsx(Ne,{}),...h,...f,"aria-label":"Drag to reorder step"}),a.jsx("div",{className:c.stepBody,children:o})]})})}export{sa as RuleEditorPanel,sa as default};
@@ -0,0 +1 @@
1
+ import{r as n,j as e,af as d,ag as u,e5 as B,k as W,m as k,t as l}from"./fluent-ui-BThr2m8u.js";import{af as M,ag as N,V as R,Z as D,w as T}from"./index-Df9NSpg6.js";import{M as V}from"./MonacoEditor-B3J81C8F.js";import"./preload-helper-PPVm8Dsz.js";import"./dnd-C19d6Mn0.js";const H=k({root:{flex:1,display:"flex",flexDirection:"column",gap:l.spacingVerticalS,minHeight:"300px"},editor:{flex:1,minHeight:"240px",border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium,overflow:"hidden"},save:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:l.spacingHorizontalS}}),L=s=>s?new TextDecoder().decode(Uint8Array.from(atob(s),r=>r.charCodeAt(0))):"",O=s=>{const r=new TextEncoder().encode(s);let o="";for(let i=0;i<r.length;i+=1)o+=String.fromCharCode(r[i]);return btoa(o)},U={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12},z=s=>U[s.split(".").pop()?.toLowerCase()??""]??3;function Y({name:s,editable:r}){const o=H(),[i,S]=n.useState(!0),[f,p]=n.useState(!1),[g,w]=n.useState(!1),[x,c]=n.useState(null),[h,m]=n.useState(null),[y,v]=n.useState(""),[b,j]=n.useState(!1);n.useEffect(()=>{let a=!0;return(async()=>{try{const t=await M(s);if(!a)return;if(!t){w(!0);return}const E=await N(t.id);a&&v(L(E))}catch(t){a&&c(t instanceof Error?t.message:"Couldn't load the script.")}finally{a&&S(!1)}})(),()=>{a=!1}},[s]);const C=async()=>{const a=T();p(!0),c(null),m(null);try{const t=await D(s,O(y),z(s),{displayName:s.split("/").pop(),guard:a});m([t.solutionWarning,t.publishWarning].filter(Boolean).join(" ")||null),j(!1)}catch(t){c(t instanceof Error?t.message:"Couldn't save the script.")}finally{p(!1)}};return e.jsxs("div",{className:o.root,children:[g&&e.jsx(d,{intent:"warning",children:e.jsxs(u,{children:["There's no web resource named ",s," in this environment. Check the action's library."]})}),x&&e.jsx(d,{intent:"error",children:e.jsx(u,{children:x})}),h&&e.jsx(d,{intent:"warning",children:e.jsx(u,{children:h})}),i?e.jsx(B,{size:"small",label:"Loading the script…"}):!g&&e.jsxs(e.Fragment,{children:[r&&e.jsxs("div",{className:o.save,children:[e.jsx(R,{prefix:"Saves to"}),e.jsx(W,{appearance:"primary",disabled:!b||f,onClick:()=>{C()},children:f?"Saving…":"Save script"})]}),e.jsx("div",{className:o.editor,children:e.jsx(V,{language:"javascript",value:y,readOnly:!r,onChange:a=>{v(a),j(!0)},options:{wordWrap:"on"}})})]})]})}export{Y as ScriptView,Y as default};
@@ -0,0 +1 @@
1
+ import{W as R,j as e,c as j,af as z,ag as O,T as F,k as v,az as V,y as m,aB as f,aA as A,Y as W,Z as $,aC as w,a0 as I,a1 as K,a4 as E,z as U,m as Y,t as o}from"./fluent-ui-BThr2m8u.js";import{b as Z,a as p,H as q,N as J,ah as Q}from"./index-Df9NSpg6.js";import{u as X}from"./useStableKeys-EsghhjoV.js";import"./preload-helper-PPVm8Dsz.js";import"./dnd-C19d6Mn0.js";function ee(d){return(d??[]).flatMap(r=>r.rules)}const se=[],P=()=>({kind:"EntityRule",appliesTo:"PrimaryEntity",context:"HomePageGrid"}),ae=()=>({kind:"PageRule",address:""}),te=Y({body:{display:"flex",flexDirection:"column",gap:o.spacingVerticalM},muted:{color:o.colorNeutralForeground3},steps:{listStyleType:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:o.spacingVerticalS},step:{display:"flex",flexDirection:"column",gap:o.spacingVerticalS,padding:o.spacingVerticalM,border:`1px solid ${o.colorNeutralStroke2}`,borderRadius:o.borderRadiusMedium},stepHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:o.spacingHorizontalS},fields:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:o.spacingHorizontalS,minWidth:0}}),re=({location:d,tabId:r})=>{const c=te(),S=Z(s=>s.editorBack),N=p(s=>s.ribbons[d]),M=p(s=>s.setTabDisplayRules),D=p(s=>s.locLabels),B=p(s=>s.baseLanguageCode),H=q(),n=N.tabs.find(s=>s.id===r),x=d==="Application",k=p(s=>!s.baseline[d]?.tabs.some(a=>a.id===r)),T=p(s=>Q(s,d)),l=!!n&&!k&&T!==void 0&&!T.includes(r),u=R.useMemo(()=>ee(n?.tabDisplayRules),[n?.tabDisplayRules]),y=X(`tabRules:${d}:${r}`,n?u:se),C=!n;if(R.useEffect(()=>{C&&S()},[C,S]),!n)return null;const b=s=>M(d,r,s.length>0?[{tabCommand:n.commandId??"",rules:s}]:[]),h=(s,a)=>{b(u.map((t,i)=>i===s?a:t)),y.update()},g=s=>{b([...u,s]),y.add()},G=s=>{b(u.filter((a,t)=>t!==s)),y.remove(s)},_=s=>[...new Set([N.entityLogicalName,s.entityName].filter(a=>!!a))],L=J(n.id,H(n.label,D,B,n.source?.titleToken));return e.jsxs("div",{className:c.body,children:[e.jsxs(j,{children:["Tabs are hidden unless their display rule matches. ",e.jsx("strong",{children:L})," shows where ",e.jsx("strong",{children:"any"})," step below matches."]}),l&&e.jsx(z,{intent:"info",children:e.jsx(O,{children:"Another solution adds this tab, so its display rule can't be changed here."})}),u.length>0?e.jsx("ol",{className:c.steps,"aria-label":"Display rule steps",children:u.map((s,a)=>e.jsxs("li",{className:c.step,children:[e.jsxs("div",{className:c.stepHeader,children:[e.jsxs(j,{weight:"semibold",children:[a+1,". ",s.kind==="PageRule"?"Page":"Entity"]}),!l&&e.jsx(F,{content:"Remove step",relationship:"label",children:e.jsx(v,{appearance:"subtle",size:"small",icon:e.jsx(V,{}),onClick:()=>G(a)})})]}),s.kind==="EntityRule"&&e.jsxs("div",{className:c.fields,children:[e.jsx(m,{label:"Applies to",children:e.jsxs(f,{value:s.appliesTo??"",disabled:l,onChange:(t,i)=>h(a,{...s,appliesTo:i.value||void 0}),children:[e.jsx("option",{value:"",children:"Any"}),e.jsx("option",{value:"PrimaryEntity",children:"Primary entity"}),e.jsx("option",{value:"SelectedEntity",children:"Selected entity"})]})}),e.jsx(m,{label:"Context",children:e.jsxs(f,{value:s.context??"",disabled:l,onChange:(t,i)=>h(a,{...s,context:i.value||void 0}),children:[e.jsx("option",{value:"",children:"Any"}),e.jsx("option",{value:"Form",children:"Form"}),e.jsx("option",{value:"HomePageGrid",children:"Home Page Grid"}),e.jsx("option",{value:"SubGridStandard",children:"SubGrid Standard"}),e.jsx("option",{value:"SubGridAssociated",children:"SubGrid Associated"})]})}),x?e.jsx(m,{label:"Entity",hint:"Leave empty for any entity.",children:e.jsx(A,{value:s.entityName??"",disabled:l,onChange:(t,i)=>h(a,{...s,entityName:i.value||void 0})})}):e.jsx(m,{label:"Entity",children:e.jsxs(f,{value:s.entityName??"",disabled:l,onChange:(t,i)=>h(a,{...s,entityName:i.value||void 0}),children:[e.jsx("option",{value:"",children:"Any"}),_(s).map(t=>e.jsx("option",{value:t,children:t},t))]})})]}),s.kind==="PageRule"&&e.jsx(m,{label:"Address pattern",validationState:s.address.trim()?"none":"error",validationMessage:s.address.trim()?void 0:"Enter the page address.",children:e.jsx(A,{value:s.address,disabled:l,onChange:(t,i)=>h(a,{...s,address:i.value}),placeholder:"https://…"})})]},y.keys[a]))}):e.jsx(j,{className:c.muted,children:l?"This tab has no display rule of its own.":k&&!x?"No steps: when you publish, this new tab gets the default rule for its location (this entity, where the tab is).":"No steps: this tab will be hidden."}),!l&&(x?e.jsx("div",{children:e.jsxs(W,{children:[e.jsx($,{disableButtonEnhancement:!0,children:e.jsx(v,{icon:e.jsx(w,{}),children:"Add step"})}),e.jsx(I,{children:e.jsxs(K,{children:[e.jsx(E,{onClick:()=>g(P()),children:"Entity"}),e.jsx(E,{onClick:()=>g(ae()),children:"Page"})]})})]})}):e.jsx("div",{children:e.jsx(v,{icon:e.jsx(w,{}),onClick:()=>g(P()),children:"Add step"})})),e.jsx(U,{className:c.muted,children:x?"Application ribbon tabs take entity and page steps.":"An entity's tabs take entity steps only."})]})};export{re as TabDisplayRulesPanel,re as default};
@@ -0,0 +1 @@
1
+ import{r as A,W as ae,j as a,c as oe,af as ne,ag as re,y as G,aA as le,z as ie,T as de,k as V,az as ue,C as ce,d as be,aC as fe,m as ge,t as B}from"./fluent-ui-BThr2m8u.js";import{b4 as I,G as _,q as pe,b as me,a as g,b5 as he,b6 as xe}from"./index-Df9NSpg6.js";import{L as W,l as h}from"./languages-CGjPBPNA.js";import"./preload-helper-PPVm8Dsz.js";import"./dnd-C19d6Mn0.js";function U(u,n,c){const f=`$LocLabels:${u}`,r=(...b)=>b.some(i=>i===f);for(const b of Object.values(n))for(const i of b.tabs){if(i.id!==c&&r(i.label,i.source?.titleToken))return!0;for(const l of i.groups){if(l.id!==c&&r(l.label,l.source?.titleToken))return!0;for(const o of pe(l))if(r(o.label,o.tooltipTitle,o.tooltipBody,o.source?.labelToken,o.source?.tooltipTitleToken,o.source?.tooltipBodyToken))return!0}}return!1}function ye(u){const{container:n,loaded:c,yours:f,ribbons:r,locLabels:b,baseLcid:i}=u;if(!f)return{reason:"not-yours"};if(c){const o=I(c.label??"");return o?U(o,r,n.id)?{reason:"shared"}:{labelId:o}:{reason:"not-yours"}}const l=n.source?.titleToken;if(l){const o=I(l);if(o&&b.some(s=>s.id===o))return U(o,r,n.id)?{reason:"shared"}:{labelId:o};if(n.label===l||n.label===_(l,[...b],i))return{reason:"kept",token:l}}return{labelId:`${n.id}.Title`}}const Le=ge({body:{display:"flex",flexDirection:"column",gap:B.spacingVerticalM},muted:{color:B.colorNeutralForeground3},row:{display:"flex",alignItems:"flex-end",gap:B.spacingHorizontalS},grow:{flex:1,minWidth:0},addField:{flex:"0 1 320px",minWidth:0}}),$e=({location:u,container:n,tabId:c,id:f})=>{const r=Le(),b=me(e=>e.editorBack),i=g(e=>e.ribbons),l=g(e=>e.baseline),o=g(e=>e.layers),k=g(e=>e.locLabels),s=g(e=>e.baseLanguageCode),q=g(e=>e.upsertLocLabel),H=g(e=>e.renameTab),K=g(e=>e.renameGroup),[J,O]=A.useState([]),[L,E]=A.useState(""),[w,P]=A.useState(!1),R=i[u].tabs.find(e=>e.id===c),T=n==="tab"?R:R?.groups.find(e=>e.id===f);if(ae.useEffect(()=>{T||b()},[T,b]),!T)return null;const M=l[u].tabs.find(e=>e.id===c),$=n==="tab"?M:M?.groups.find(e=>e.id===f),z=he(n,f,l[u],xe({layers:o},u)),p=ye({container:T,loaded:$,yours:z,ribbons:i,locLabels:k,baseLcid:s}),m="labelId"in p?p.labelId:null,Q=z&&($?!!I($.label??""):!0),x=k.find(e=>e.id===m),X=e=>x?.titles.find(t=>t.languageCode===s)?.description??e,v=_(T.label,k,s),Y=e=>e===s?v:x?.titles.find(t=>t.languageCode===e)?.description??"",S=[s,...new Set([...(x?.titles??[]).map(e=>e.languageCode),...J].filter(e=>e!==s))].sort((e,t)=>e===s?-1:t===s?1:e-t),D=(e,t,d)=>{if(!m)return;const C=new Map((x?.titles??[]).filter(y=>y.languageCode!==s).map(y=>[y.languageCode,y.description]));e!==null&&e!==s&&(t?C.set(e,t):C.delete(e)),!(!x&&C.size===0)&&q({id:m,titles:[{languageCode:s,description:X(d)},...[...C].map(([y,se])=>({languageCode:y,description:se}))]})},Z=(e,t)=>{if(e!==s)return D(e,t,v);P(!t.trim()),t.trim()&&(n==="tab"?H(u,c,t):K(u,c,f,t))},ee=e=>{x?.titles.some(t=>t.languageCode===e)&&D(e,"",v),O(t=>t.filter(d=>d!==e))},N=e=>{const t=Number(/\d+/.exec(e)?.[0])||Number(Object.entries(W).find(([,d])=>d===e)?.[0]);!t||S.includes(t)||(O(d=>d.includes(t)?d:[...d,t]),E(""))},F=L.trim().toLowerCase(),te=Object.keys(W).map(Number).filter(e=>!S.includes(e)).filter(e=>!F||`${h(e)} (${e})`.toLowerCase().includes(F)),j=n==="tab"?"tab":"group";return a.jsxs("div",{className:r.body,children:[m?a.jsxs(oe,{children:[h(s)," is the organization's base language: its text is the ",j,"'s title. Other languages are published with it."]}):a.jsx(ne,{intent:"info",children:a.jsx(re,{children:"reason"in p&&p.reason==="shared"?`This ${j}'s title is a label other tabs, groups or buttons use too, so its translations aren't edited here: they'd change for all of them.`:"reason"in p&&p.reason==="kept"?`This ${j} keeps the title of the one it was copied or imported from (${p.token}). Change the title first: it then gets a label of its own to translate.`:`Only your own tabs and groups can be translated: this ${j}'s title comes from Microsoft or another solution.`})}),S.map(e=>a.jsxs("div",{className:r.row,children:[a.jsx(G,{className:r.grow,label:a.jsxs(a.Fragment,{children:[h(e)," ",a.jsxs(ie,{className:r.muted,children:[e,e===s?" · base language":""]})]}),validationState:e===s&&w?"error":"none",validationMessage:e===s&&w?`A ${j} needs a title.`:void 0,children:a.jsx(le,{"aria-label":`Title (${h(e)})`,value:e===s&&w?"":Y(e),readOnly:e===s?!Q:!m,onChange:(t,d)=>Z(e,d.value)})}),e!==s&&!!m&&a.jsx(de,{content:`Remove ${h(e)}`,relationship:"label",children:a.jsx(V,{appearance:"subtle",icon:a.jsx(ue,{}),onClick:()=>ee(e)})})]},e)),!!m&&a.jsxs("div",{className:r.row,children:[a.jsx(G,{label:"Add a language",className:r.addField,children:a.jsx(ce,{freeform:!0,placeholder:"Language or LCID",value:L,onChange:e=>E(e.target.value),onOptionSelect:(e,t)=>t.optionValue&&N(t.optionValue),onKeyDown:e=>e.key==="Enter"&&N(L),children:te.map(e=>a.jsx(be,{value:String(e),text:`${h(e)} (${e})`,children:`${h(e)} (${e})`},e))})}),a.jsx(V,{icon:a.jsx(fe,{}),disabled:!L.trim(),onClick:()=>N(L),children:"Add"})]})]})};export{$e as TitleTranslationsView,$e as default};
@@ -0,0 +1 @@
1
+ import{r as v,W as se,j as o,af as W,ag as _,c as G,z as K,T as U,k as z,az as ne,y as q,em as le,aA as ie,f2 as re,C as de,d as ce,aC as ue,m as ge,t as u}from"./fluent-ui-BThr2m8u.js";import{b as pe,a as j,q as be,b0 as E,b1 as me,b2 as he,b3 as fe}from"./index-Df9NSpg6.js";import{L as J,l as p}from"./languages-CGjPBPNA.js";import"./preload-helper-PPVm8Dsz.js";import"./dnd-C19d6Mn0.js";const xe="​​",C=[{field:"label",name:"Label"},{field:"tooltipTitle",name:"Tooltip title"},{field:"tooltipBody",name:"Tooltip body",multiline:!0}],je=ge({body:{display:"flex",flexDirection:"column",gap:u.spacingVerticalM},muted:{color:u.colorNeutralForeground3},add:{display:"flex",alignItems:"flex-end",gap:u.spacingHorizontalS},addField:{flex:"0 1 320px",minWidth:0},language:{display:"flex",flexDirection:"column",gap:u.spacingVerticalS,padding:u.spacingVerticalM,border:`1px solid ${u.colorNeutralStroke2}`,borderRadius:u.borderRadiusMedium},languageHeader:{display:"flex",alignItems:"center",gap:u.spacingHorizontalS},languageName:{flex:1,minWidth:0},fields:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:u.spacingHorizontalM,alignItems:"start"}}),ke=({buttonId:O})=>{const d=je(),M=pe(e=>e.editorBack),R=j(e=>e.ribbons),y=j(e=>e.locLabels),s=j(e=>e.baseLanguageCode),Q=j(e=>e.upsertLocLabel),X=j(e=>e.setButtonProp),b=v.useMemo(()=>{for(const[e,t]of Object.entries(R))for(const a of t.tabs)for(const i of a.groups)for(const n of be(i))if(n.id===O)return{button:n,location:e,tabId:a.id,groupId:i.id}},[R,O]),[Y,D]=v.useState([]),[h,V]=v.useState(""),[Z,ee]=v.useState(!1),F=!b;if(se.useEffect(()=>{F&&M()},[F,M]),!b)return null;const{button:l}=b,m=l.source,T={label:E(m?.labelToken,fe(l.id),l.label,y,s),tooltipTitle:E(m?.tooltipTitleToken,he(l.id),l.tooltipTitle,y,s),tooltipBody:E(m?.tooltipBodyToken,me(l.id),l.tooltipBody,y,s)},H={label:m?.labelToken,tooltipTitle:m?.tooltipTitleToken,tooltipBody:m?.tooltipBodyToken},f=C.filter(({field:e})=>T[e]===null&&H[e]).map(({field:e})=>H[e].slice(11)).filter((e,t,a)=>a.indexOf(e)===t),L=l.origin!==void 0&&l.origin!=="unmanaged",x=e=>y.find(t=>t.id===T[e]),k=e=>l[e]??"",N=(e,t)=>t===s?k(e):x(e)?.titles.find(a=>a.languageCode===t)?.description??"",B=[s,...new Set([...C.flatMap(({field:e})=>(x(e)?.titles??[]).map(t=>t.languageCode)),...Y].filter(e=>e!==s))].sort((e,t)=>e===s?-1:t===s?1:e-t),I=(e,t,a,i)=>{const n=T[e];if(!n)return;const g=x(e),c=new Map((g?.titles??[]).filter(r=>r.languageCode!==s).map(r=>[r.languageCode,r.description]));t!==null&&t!==s&&(a?c.set(t,a):c.delete(t)),!(!g&&c.size===0)&&Q({id:n,titles:[...i?[{languageCode:s,description:i}]:[],...[...c].map(([r,$])=>({languageCode:r,description:$}))]})},S=(e,t,a)=>{if(t!==s)return I(e,t,a,k(e));e==="label"&&(ee(!a),!a)||(X(b.location,b.tabId,b.groupId,l.id,{[e]:e==="label"?a:a||void 0}),x(e)&&I(e,null,"",a))},te=e=>{for(const{field:t}of C)x(t)?.titles.some(a=>a.languageCode===e)&&I(t,e,"",k(t));D(t=>t.filter(a=>a!==e))},w=e=>{const t=Number(/\d+/.exec(e)?.[0])||Number(Object.entries(J).find(([,a])=>a===e)?.[0]);!t||B.includes(t)||(D(a=>a.includes(t)?a:[...a,t]),V(""))},ae=(e,t,a)=>{const i=document.getElementById(a),n=N(e,t),g=i?.selectionStart??n.length,c=i?.selectionEnd??n.length;S(e,t,n.slice(0,g)+xe+n.slice(c))},P=h.trim().toLowerCase(),oe=Object.keys(J).map(Number).filter(e=>!B.includes(e)).filter(e=>!P||`${p(e)} (${e})`.toLowerCase().includes(P));return o.jsxs("div",{className:d.body,children:[L?o.jsx(W,{intent:"info",children:o.jsx(_,{children:"This button isn't yours, so its text is read-only. Customise it in Properties to give it text of its own, then translate it."})}):o.jsxs(G,{children:[p(s)," is the organization's base language: its text is the button's own. Other languages are published with it."]}),f.length>0&&o.jsx(W,{intent:"info",children:o.jsxs(_,{children:[f.join(", ")," ",f.length===1?"is a label":"are labels"," of another solution, shared with the controls that use"," ",f.length===1?"it":"them",", so"," ",f.length===1?"it isn't":"they aren't"," edited here. Change the text in Properties to give this button a label of its own."]})}),B.map(e=>o.jsxs("section",{className:d.language,"aria-label":`${p(e)} (${e})`,children:[o.jsxs("div",{className:d.languageHeader,children:[o.jsxs(G,{weight:"semibold",className:d.languageName,children:[p(e)," ",o.jsxs(K,{className:d.muted,children:[e,e===s?" · base language":""]})]}),e!==s&&!L&&o.jsx(U,{content:`Remove ${p(e)}`,relationship:"label",children:o.jsx(z,{appearance:"subtle",size:"small",icon:o.jsx(ne,{}),onClick:()=>te(e)})})]}),o.jsx("div",{className:d.fields,children:C.map(({field:t,name:a,multiline:i})=>{const n=`tr-${e}-${t}`,g=L||!T[t],c=`${a} (${p(e)})`,r=t==="label"&&e===s&&Z;return o.jsx(q,{label:a,validationState:r?"error":"none",validationMessage:r?"A button needs a label.":void 0,children:i?o.jsx(le,{id:n,"aria-label":c,value:N(t,e),readOnly:g,resize:"vertical",onChange:($,A)=>S(t,e,A.value)}):o.jsx(ie,{id:n,"aria-label":c,value:r?"":N(t,e),readOnly:g,onChange:($,A)=>S(t,e,A.value),contentAfter:g?void 0:o.jsx(U,{content:"Insert a line break",relationship:"label",children:o.jsx(z,{appearance:"transparent",size:"small",icon:o.jsx(re,{}),onClick:()=>ae(t,e,n)})})})},t)})})]},e)),!L&&o.jsxs("div",{className:d.add,children:[o.jsx(q,{label:"Add a language",className:d.addField,children:o.jsx(de,{freeform:!0,placeholder:"Language or LCID",value:h,onChange:e=>V(e.target.value),onOptionSelect:(e,t)=>t.optionValue&&w(t.optionValue),onKeyDown:e=>e.key==="Enter"&&w(h),children:oe.map(e=>o.jsx(ce,{value:String(e),text:`${p(e)} (${e})`,children:`${p(e)} (${e})`},e))})}),o.jsx(z,{icon:o.jsx(ue,{}),disabled:!h.trim(),onClick:()=>w(h),children:"Add"})]}),o.jsx(K,{className:d.muted,children:"The line break button puts Dataverse's line break (two zero-width spaces) where a long label should wrap."})]})};export{xe as LINE_BREAK,ke as TranslationsView,ke as default};
@@ -0,0 +1 @@
1
+ import{r as n,dW as de,j as s,dZ as me,aB as he,eZ as xe,af as z,ag as M,e5 as ge,c as A,e as pe,e2 as fe,k as D,bV as be,m as je,dX as P,e4 as we,dV as $,c5 as I,as as j,$ as w,t as h}from"./fluent-ui-BThr2m8u.js";import{b as V,d as ve,O as Y,A as Se,$ as ye,a0 as Ce,a1 as X,a2 as Re,V as Ee,Z as We,_ as Ne,k as ke,a3 as Z,w as De}from"./index-Df9NSpg6.js";import{u as Ie}from"./useReplaceWebResourceConfirm-BUfgdCRQ.js";import"./preload-helper-PPVm8Dsz.js";import"./dnd-C19d6Mn0.js";const q=je({content:{display:"flex",flexDirection:"column",gap:h.spacingVerticalS,height:"min(560px, calc(100vh - 220px))",minHeight:"240px",overflowY:"hidden"},toolbar:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:h.spacingHorizontalS,flexShrink:0},search:{flex:1,minWidth:"200px"},box:{flex:1,minHeight:0,overflowX:"auto",overflowY:"hidden"},row:{cursor:"pointer"},muted:{color:h.colorNeutralForeground3},state:{padding:h.spacingVerticalL,textAlign:"center"},reference:{flexShrink:0,overflowWrap:"anywhere",fontFamily:h.fontFamilyMonospace}}),Be={js:s.jsx(w,{}),ts:s.jsx(w,{}),css:s.jsx(w,{}),html:s.jsx(w,{}),svg:s.jsx(j,{}),png:s.jsx(j,{}),gif:s.jsx(j,{}),jpg:s.jsx(j,{}),xml:s.jsx(I,{}),resx:s.jsx(I,{})};function v(a){return a.split(".").pop()?.toLowerCase()??""}const He=[{label:"All types",value:"all"},{label:".js",value:"js"},{label:".html",value:"html"},{label:".svg",value:"svg"},{label:".png",value:"png"},{label:".css",value:"css"},{label:".xml",value:"xml"},{label:".resx",value:"resx"}],Oe=[P({columnId:"name",renderHeaderCell:()=>"Name",renderCell:a=>s.jsx($,{truncate:!0,media:Be[v(a.name)]??s.jsx(I,{}),description:a.description||void 0,children:a.name})}),P({columnId:"modified",renderHeaderCell:()=>"Modified",renderCell:a=>s.jsx($,{truncate:!0,children:a.modifiedOn?new Date(a.modifiedOn).toLocaleDateString():"—"})})],Le={name:{minWidth:240,idealWidth:720},modified:{minWidth:96,idealWidth:120}},K=52,Te=34,J=n.createContext({choose:()=>{}});function Fe({item:a,style:o}){const x=q(),{choose:c}=n.useContext(J);return s.jsx(X,{style:o,className:x.row,"data-web-resource":a.name,onDoubleClick:()=>c(a),onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),c(a))},children:({renderCell:i})=>s.jsx(we,{children:i(a)})})}const Ge=({item:a},o)=>s.jsx(Fe,{item:a,style:o}),Pe=({onSelect:a})=>{const o=q(),x=Ie(),c=V(e=>e.webResourceBrowserOpen),i=V(e=>e.closeWebResourceBrowser),Q=ve(e=>e.publisherPrefix),B=n.useRef(null),[S,H]=n.useState([]),[O,g]=n.useState(!1),[L,T]=n.useState(!1),[y,d]=n.useState(null),[C,R]=n.useState(null),[E,ee]=n.useState(""),[p,se]=n.useState("all"),[W,te]=n.useState(!0),[f,F]=n.useState(null),N=n.useRef(null),[ne,G]=n.useState(0),ae=f!==null;n.useLayoutEffect(()=>{G(N.current?.clientHeight??0)},[c,O,y,C,ae]),n.useEffect(()=>{const e=N.current;if(!e||typeof ResizeObserver>"u")return;const t=new ResizeObserver(([r])=>G(Math.floor(r.contentRect.height)));return t.observe(e),()=>t.disconnect()},[c]);const re=de({tabBehavior:"unlimited",ignoreDefaultKeydown:{Enter:!0}}),k=n.useMemo(()=>{const e=E.toLowerCase();return S.filter(t=>{const r=v(t.name),l=e===""||t.name.toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e),u=p==="all"||r===p,b=!W||t.isCustom;return l&&u&&b})},[S,E,p,W]),m=k.find(e=>e.id===f)??null;n.useEffect(()=>{c&&(F(null),g(!0),d(null),R(null),Y().then(e=>H(e)).catch(e=>d(e instanceof Error?e.message:String(e))).finally(()=>g(!1)))},[c]);const oe=async()=>{g(!0),d(null);try{H(await Y())}catch(e){d(e instanceof Error?e.message:String(e))}finally{g(!1)}},le=e=>new Promise((t,r)=>{const l=new FileReader;l.onerror=()=>r(l.error??new Error("Unable to read file")),l.onload=()=>{const u=String(l.result??"");t(u.includes(",")?u.split(",")[1]??"":u)},l.readAsDataURL(e)}),ce=e=>{const t=v(e.name);return`${Q||"new"}_/${t==="js"||t==="css"||t==="html"||t==="xml"?"scripts":t==="svg"||t==="png"?"icons":"webresources"}/${e.name}`},ie=async e=>{const t=De();T(!0),R(null);try{const r=await le(e),l=v(e.name),u={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12}[l]??4,b=await We(ce(e),r,u,{displayName:e.name,guard:t,onExisting:x.onExisting});await oe(),R([b.solutionWarning,b.publishWarning].filter(Boolean).join(" ")||null)}catch(r){if(r instanceof Ne)return;const l=r instanceof Error?r.message:String(r);d(l),ke.getState().logError("webresource",`Upload of ${e.name} failed: ${l}`)}finally{T(!1)}},U=()=>{Z.clear(),i()},_=e=>{Z.invoke(e),a?.(e),i()},ue=Math.max(K,ne-Te);return s.jsxs(s.Fragment,{children:[x.dialog,s.jsxs(Se,{open:c,onOpenChange:e=>!e&&U(),title:"Choose a web resource",size:"large",contentClassName:o.content,startActions:s.jsxs(s.Fragment,{children:[s.jsx(D,{icon:s.jsx(be,{}),disabled:L,onClick:()=>B.current?.click(),children:L?"Uploading…":"Upload…"}),s.jsx(Ee,{prefix:"Uploads to"})]}),actions:s.jsxs(s.Fragment,{children:[s.jsx(D,{appearance:"secondary",onClick:U,children:"Cancel"}),s.jsx(D,{appearance:"primary",disabled:!m,onClick:()=>m&&_(m),children:"Select"})]}),children:[s.jsx("input",{ref:B,type:"file",accept:".js,.html,.svg,.png,.css,.xml,.resx,.jpg,.gif,.ico,.xsl",style:{display:"none"},onChange:e=>{const t=e.target.files?.[0];e.currentTarget.value="",t&&ie(t)}}),s.jsxs("div",{className:o.toolbar,children:[s.jsx(me,{"data-autofocus":!0,"aria-label":"Search the web resources by name",placeholder:"Search by name…",value:E,onChange:(e,t)=>ee(t.value),className:o.search}),s.jsx(he,{"aria-label":"Type",value:p,onChange:(e,t)=>se(t.value),children:He.map(e=>s.jsx("option",{value:e.value,children:e.label},e.value))}),s.jsx(xe,{label:"Custom only",checked:W,onChange:(e,t)=>te(t.checked===!0)})]}),y&&s.jsx(z,{intent:"error",children:s.jsx(M,{children:y})}),C&&s.jsx(z,{intent:"warning",children:s.jsx(M,{children:C})}),s.jsx("div",{ref:N,className:o.box,...re,children:O?s.jsx(ge,{className:o.state,size:"small",label:"Loading web resources…"}):k.length===0?s.jsx(A,{as:"p",className:pe(o.state,o.muted),children:S.length===0?"No web resources in this environment.":"No web resources match."}):s.jsx(J.Provider,{value:{choose:_},children:s.jsxs(ye,{items:k,columns:Oe,columnSizingOptions:Le,resizableColumns:!0,getRowId:e=>e.id,focusMode:"composite",selectionMode:"single",subtleSelection:!0,"aria-label":"Web resources",selectedItems:f?new Set([f]):new Set,onSelectionChange:(e,t)=>{const r=[...t.selectedItems][0];F(r??null)},children:[s.jsx(Ce,{children:s.jsx(X,{children:({renderHeaderCell:e})=>s.jsx(fe,{children:e()})})}),s.jsx(Re,{itemSize:K,height:ue,listProps:{width:"100%"},children:Ge})]})})}),m&&s.jsxs(A,{size:200,className:o.reference,children:[s.jsx("span",{className:o.muted,children:"Reference: "}),"$webresource:",m.name]})]})]})};export{Pe as WebResourceBrowser,Pe as default};
@@ -0,0 +1,2 @@
1
+ import{r as o,j as n,z as P,e6 as O,e7 as B,N as V,R,ax as U,bX as _,f1 as H,bV as z,af as G,ag as K,m as W,t as y}from"./fluent-ui-BThr2m8u.js";import{a as b,b as E,O as Q,ai as Y,M as q,j as J,aj as Z}from"./index-Df9NSpg6.js";import{M as ee}from"./MonacoEditor-B3J81C8F.js";import"./preload-helper-PPVm8Dsz.js";import"./dnd-C19d6Mn0.js";const te=["Add","AddCircle","Alert","AppFolder","Archive","ArrowClockwise","ArrowCounterclockwise","ArrowDown","ArrowExport","ArrowImport","ArrowLeft","ArrowRight","ArrowSync","ArrowUp","Attach","Beaker","Bookmark","Bug","Building","Calculator","CalendarLtr","CalendarMonth","Call","Camera","Cart","Chart","Checkmark","CheckmarkCircle","Circle","ClipboardTask","Clock","Cloud","Code","CodeBlock","Comment","ContactCard","Copy","CreditCard","Crown","Cube","CursorClick","DataBarVertical","Delete","Diamond","Document","DocumentCopy","DocumentEdit","DocumentText","Download","Edit","Emoji","ErrorCircle","Eye","EyeOff","Filter","Flag","Flow","FolderOpen","Globe","Grid","Group","Heart","Home","Image","Info","Key","Library","Link","List","Location","Lock","Mail","Map","MegaphoneLoud","Money","MoreCircle","MoreHorizontal","Note","NoteEdit","NumberCircle1","Open","Organization","Pause","People","PeopleCommunity","Person","PersonAdd","PersonSearch","Phone","Play","Plug","Print","Question","Refresh","Rename","Save","Search","Send","Settings","Share","Shield","ShoppingBag","Sparkle","Star","StarEmphasis","Stop","Table","Tag","TaskList","TextBulletList","TextDescription","ThumbLike","Timer","ToggleLeft","ToggleRight","Tool","Translate","Umbrella","Unlock","Upload","Video","Warning","Wrench"];function A(a,C){const h=[];return h.push(a.languages.registerCompletionItemProvider("xml",{triggerCharacters:[":","$"],provideCompletionItems(m,e){const r=m.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!r.includes("$LocLabels:"))return{suggestions:[]};const d=r.lastIndexOf("$LocLabels:")+11,i=r.slice(d),u={startLineNumber:e.lineNumber,startColumn:e.column-i.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:b.getState().locLabels.map(c=>({label:c.id,kind:a.languages.CompletionItemKind.Reference,insertText:c.id,range:u,detail:"LocLabel reference"}))}}})),h.push(a.languages.registerCompletionItemProvider("xml",{triggerCharacters:[":","$"],provideCompletionItems(m,e){const r=m.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!r.includes("$webresource:"))return{suggestions:[]};const d=r.lastIndexOf("$webresource:")+13,i=r.slice(d),u={startLineNumber:e.lineNumber,startColumn:e.column-i.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:C().map(c=>({label:c,kind:a.languages.CompletionItemKind.File,insertText:c,range:u,detail:"Web resource"}))}}})),h.push(a.languages.registerCompletionItemProvider("xml",{triggerCharacters:['"'],provideCompletionItems(m,e){const r=m.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!/Command\s*=\s*"[^"]*$/.test(r))return{suggestions:[]};const i=r.match(/Command\s*=\s*"([^"]*)$/)?.[1]??"",u={startLineNumber:e.lineNumber,startColumn:e.column-i.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:b.getState().commands.map(c=>({label:c.id,kind:a.languages.CompletionItemKind.Function,insertText:c.id,range:u,detail:"CommandDefinition"}))}}})),h.push(a.languages.registerCompletionItemProvider("xml",{triggerCharacters:['"'],provideCompletionItems(m,e){const r=m.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!/ModernImage\s*=\s*"[^"]*$/.test(r))return{suggestions:[]};const i=r.match(/ModernImage\s*=\s*"([^"]*)$/)?.[1]??"",u={startLineNumber:e.lineNumber,startColumn:e.column-i.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:te.map(l=>({label:l,kind:a.languages.CompletionItemKind.Color,insertText:l,range:u,detail:"Fluent icon (ModernImage)",documentation:`Renders the ${l}_20_Regular Fluent icon`}))}}})),h}function T(a){a.forEach(C=>C.dispose())}const ne=W({root:{flex:1,display:"flex",flexDirection:"column",gap:y.spacingVerticalS,minHeight:"320px"},muted:{color:y.colorNeutralForeground3},editor:{flex:1,minHeight:"240px",border:`1px solid ${y.colorNeutralStroke2}`,borderRadius:y.borderRadiusMedium,overflow:"hidden"}}),re=["HomepageGrid","SubGrid","Form","Application"],ce=({location:a})=>{const C=ne(),h=E(t=>t.closeEditor),m=E(t=>t.openImportXml),e=b(t=>t.ribbons),r=b(t=>t.baseline),d=b(t=>t.commands),i=b(t=>t.displayRules),u=b(t=>t.enableRules),f=b(t=>t.locLabels),[l,c]=o.useState(a),[S,g]=o.useState(null),[j,w]=o.useState(!1),p=o.useRef(0);o.useEffect(()=>{p.current++,g(null)},[l]);const[k,v]=o.useState([]),M=o.useRef(null),I=o.useRef(null),x=o.useRef([]);o.useEffect(()=>{Q().then(t=>v(t.map(s=>s.name))).catch(()=>v([]))},[]),o.useEffect(()=>()=>{T(x.current),x.current=[]},[]);const $=o.useCallback((t,s)=>{M.current=t,I.current=s,T(x.current),x.current=A(s,()=>k)},[k]);o.useEffect(()=>{I.current&&(T(x.current),x.current=A(I.current,()=>k))},[k]);const D=()=>{M.current?.getAction("editor.action.formatDocument")?.run()},N=o.useCallback(t=>{try{return`<?xml version="1.0" encoding="utf-8"?>
2
+ ${Y({location:t,current:e[t],baseline:r[t],commands:d,displayRules:i,enableRules:u,locLabels:f,entityLogicalName:e[t].entityLogicalName})}`}catch(s){return`<!-- Error generating XML: ${String(s)} -->`}},[e,r,d,i,u,f])(l);o.useEffect(()=>{p.current++,g(null)},[N]);const F=async()=>{const t=p.current,s=await J(N);t===p.current&&g(s.ok?{intent:"success",text:"Copied the XML to the clipboard."}:{intent:"error",text:`Couldn't copy (${s.error}). Click in the XML, press Ctrl+A, then Ctrl+C.`})},X=async()=>{const t=p.current,s=`RibbonDiffXml_${l}.xml`;w(!0),g(null);try{const L=await Z(s,N,[{name:"XML",extensions:["xml"]}]);if(t!==p.current)return;L.ok&&L.path?g({intent:"success",text:`Saved to ${L.path}.`}):L.ok?g({intent:"success",text:`Started downloading ${s}. If no file appears, use Copy.`}):L.canceled?g(null):g({intent:"error",text:`Couldn't save the file (${L.error}). Use Copy instead.`})}finally{w(!1)}};return n.jsxs("div",{className:C.root,children:[n.jsx(P,{className:C.muted,children:"Your changes to this location, as RibbonDiffXml. Publish merges them into your solution's layer; its View XML shows the merged result."}),n.jsx(O,{size:"small",selectedValue:l,onTabSelect:(t,s)=>c(s.value),children:re.map(t=>n.jsx(B,{value:t,children:q[t].label},t))}),n.jsxs(V,{size:"small","aria-label":"XML actions",children:[n.jsx(R,{icon:n.jsx(U,{}),onClick:()=>{F()},children:"Copy"}),n.jsx(R,{icon:n.jsx(_,{}),disabled:j,onClick:()=>{X()},children:"Download"}),n.jsx(R,{icon:n.jsx(H,{}),onClick:D,children:"Format"}),n.jsx(R,{icon:n.jsx(z,{}),onClick:()=>{h(),m(N)},children:"Import this XML"})]}),S&&n.jsx(G,{intent:S.intent,role:"status",children:n.jsx(K,{children:S.text})}),n.jsx("div",{className:C.editor,children:n.jsx(ee,{language:"xml",value:N,readOnly:!0,height:"100%",onMount:$})})]})};export{ce as XmlView,ce as default};
@@ -0,0 +1 @@
1
+ const t=[{value:"PrimaryControl",group:"Context",label:"Primary Control",description:"The form's context (formContext) on a form. On a grid, use SelectedControl."},{value:"PrimaryControlId",group:"Context",label:"Primary Control ID",description:"The id of the primary control."},{value:"SelectedControl",group:"Context",label:"Selected Control",description:"The grid's context (gridContext): the main grid or the sub-grid the command runs on."},{value:"CommandProperties",group:"Context",label:"Command Properties",description:"Details of the ribbon control that ran the command, for one function serving several buttons."},{value:"PrimaryEntityTypeCode",group:"Record",label:"Primary Entity Type Code",description:"The type code of the record's entity."},{value:"PrimaryEntityTypeName",group:"Record",label:"Primary Entity Type Name",description:"The logical name of the entity of the record being viewed (on a form) or of the main grid."},{value:"FirstPrimaryItemId",group:"Record",label:"First Primary Item ID",description:"The id of the record being viewed. Empty on a main grid: use the grid selection values there."},{value:"PrimaryItemIds",group:"Record",label:"Primary Item IDs",description:"On a main grid, the ids of the records it displays."},{value:"SelectedEntityTypeCode",group:"Selection context",label:"Selected Entity Type Code",description:"The type code of the grid's entity."},{value:"SelectedEntityTypeName",group:"Selection context",label:"Selected Entity Type Name",description:"The logical name of the grid's entity (main grid or sub-grid)."},{value:"FirstSelectedItemId",group:"Selection context",label:"First Selected Item ID",description:"The id of the first selected row of the grid."},{value:"SelectedControlSelectedItemCount",group:"Grid selection",label:"Selected Item Count",description:"How many rows of the grid are selected."},{value:"SelectedControlSelectedItemIds",group:"Grid selection",label:"Selected Item IDs",description:"The ids of the selected rows."},{value:"SelectedControlSelectedItemReferences",group:"Grid selection",label:"Selected Item References",description:"References (id, entity, name) of the selected rows."},{value:"SelectedControlAllItemCount",group:"Grid selection",label:"All Item Count",description:"How many rows the grid shows."},{value:"SelectedControlAllItemIds",group:"Grid selection",label:"All Item IDs",description:"The ids of every row the grid shows."},{value:"SelectedControlAllItemReferences",group:"Grid selection",label:"All Item References",description:"References (id, entity, name) of every row the grid shows."},{value:"SelectedControlUnselectedItemCount",group:"Grid selection",label:"Unselected Item Count",description:"How many rows of the grid aren't selected."},{value:"SelectedControlUnselectedItemIds",group:"Grid selection",label:"Unselected Item IDs",description:"The ids of the rows that aren't selected."},{value:"SelectedControlUnselectedItemReferences",group:"Grid selection",label:"Unselected Item References",description:"References (id, entity, name) of the rows that aren't selected."},{value:"OrgName",group:"Org/User",label:"Org Name",description:"The organization's unique name."},{value:"OrgLcid",group:"Org/User",label:"Org LCID",description:"The organization's base language (LCID)."},{value:"UserLcid",group:"Org/User",label:"User LCID",description:"The user's language (LCID)."}],n={PrimaryEntityTypeCode:"PrimaryEntityTypeName",SelectedEntityTypeCode:"SelectedEntityTypeName"};function l(e){return t.find(r=>r.value===e)?.description}const o=new Set(["SelectedControlSelectedItemReferences","SelectedControlAllItemReferences","SelectedControlUnselectedItemReferences"]),d=["data","typename","type","id","orgname","userlcid","orglcid","formid","entrypoint"],i=new Set(t.map(e=>e.value));function s(e){return i.has(e)&&!o.has(e)}export{i as C,n as D,o as U,d as W,l as c,s as i};
@@ -1,4 +1,4 @@
1
- import{r as l,W as I,a as Ne}from"./fluent-ui-CQyNN9H3.js";function Nn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const rt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function we(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function wt(e){return"nodeType"in e}function z(e){var t,n;return e?we(e)?e:wt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function xt(e){const{Document:t}=z(e);return e instanceof t}function Fe(e){return we(e)?!1:e instanceof z(e).HTMLElement}function qt(e){return e instanceof z(e).SVGElement}function xe(e){return e?we(e)?e.document:wt(e)?xt(e)?e:Fe(e)||qt(e)?e.ownerDocument:document:document:document}const V=rt?l.useLayoutEffect:l.useEffect;function ot(e){const t=l.useRef(e);return V(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Tn(){const e=l.useRef(null),t=l.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Pe(e,t){t===void 0&&(t=[e]);const n=l.useRef(e);return V(()=>{n.current!==e&&(n.current=e)},t),n}function $e(e,t){const n=l.useRef();return l.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function _e(e){const t=ot(e),n=l.useRef(null),r=l.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Qe(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}let ft={};function Xe(e,t){return l.useMemo(()=>{if(t)return t;const n=ft[e]==null?0:ft[e]+1;return ft[e]=n,e+"-"+n},[e,t])}function Gt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[c,u]of a){const f=i[c];f!=null&&(i[c]=f+e*u)}return i},{...t})}}const ye=Gt(1),ze=Gt(-1);function Ln(e){return"clientX"in e&&"clientY"in e}function it(e){if(!e)return!1;const{KeyboardEvent:t}=z(e.target);return t&&e instanceof t}function kn(e){if(!e)return!1;const{TouchEvent:t}=z(e.target);return t&&e instanceof t}function Ze(e){if(kn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Ln(e)?{x:e.clientX,y:e.clientY}:null}const fe=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[fe.Translate.toString(e),fe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Pt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Pn(e){return e.matches(Pt)?e:e.querySelector(Pt)}const zn={display:"none"};function Bn(e){let{id:t,value:n}=e;return I.createElement("div",{id:t,style:zn},n)}function Fn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return I.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function $n(){const[e,t]=l.useState("");return{announce:l.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Jt=l.createContext(null);function Xn(e){const t=l.useContext(Jt);l.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function jn(){const[e]=l.useState(()=>new Set),t=l.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[l.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const Yn={draggable:`
1
+ import{r as l,W as I,a as Ne}from"./fluent-ui-BThr2m8u.js";function Nn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const rt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function we(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function wt(e){return"nodeType"in e}function z(e){var t,n;return e?we(e)?e:wt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function xt(e){const{Document:t}=z(e);return e instanceof t}function Fe(e){return we(e)?!1:e instanceof z(e).HTMLElement}function qt(e){return e instanceof z(e).SVGElement}function xe(e){return e?we(e)?e.document:wt(e)?xt(e)?e:Fe(e)||qt(e)?e.ownerDocument:document:document:document}const V=rt?l.useLayoutEffect:l.useEffect;function ot(e){const t=l.useRef(e);return V(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Tn(){const e=l.useRef(null),t=l.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Pe(e,t){t===void 0&&(t=[e]);const n=l.useRef(e);return V(()=>{n.current!==e&&(n.current=e)},t),n}function $e(e,t){const n=l.useRef();return l.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function _e(e){const t=ot(e),n=l.useRef(null),r=l.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Qe(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}let ft={};function Xe(e,t){return l.useMemo(()=>{if(t)return t;const n=ft[e]==null?0:ft[e]+1;return ft[e]=n,e+"-"+n},[e,t])}function Gt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[c,u]of a){const f=i[c];f!=null&&(i[c]=f+e*u)}return i},{...t})}}const ye=Gt(1),ze=Gt(-1);function Ln(e){return"clientX"in e&&"clientY"in e}function it(e){if(!e)return!1;const{KeyboardEvent:t}=z(e.target);return t&&e instanceof t}function kn(e){if(!e)return!1;const{TouchEvent:t}=z(e.target);return t&&e instanceof t}function Ze(e){if(kn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Ln(e)?{x:e.clientX,y:e.clientY}:null}const fe=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[fe.Translate.toString(e),fe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Pt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Pn(e){return e.matches(Pt)?e:e.querySelector(Pt)}const zn={display:"none"};function Bn(e){let{id:t,value:n}=e;return I.createElement("div",{id:t,style:zn},n)}function Fn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return I.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function $n(){const[e,t]=l.useState("");return{announce:l.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Jt=l.createContext(null);function Xn(e){const t=l.useContext(Jt);l.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function jn(){const[e]=l.useState(()=>new Set),t=l.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[l.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const Yn={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.