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

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 (152) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/README.md +11 -13
  3. package/SECURITY.md +4 -4
  4. package/dist/assets/BulkPublishModal-BWRed6Fv.js +36 -0
  5. package/dist/assets/CommandEditorPanel-B7W3Sqiu.js +1 -0
  6. package/dist/assets/CommandPalette-Fc4MPKvd.js +1 -0
  7. package/dist/assets/CompareView-D1FOwnU1.js +7 -0
  8. package/dist/assets/CrmParameterEditor-DO6Rt764.js +1 -0
  9. package/dist/assets/EditorDrawer-BtFb9OzQ.js +2 -0
  10. package/dist/assets/HideInsteadOfDeleteModal-fdtkLfSG.js +1 -0
  11. package/dist/assets/IconPickerModal-FyQ9ud3R.js +1 -0
  12. package/dist/assets/ImportXmlModal-BZq0Iglk.js +1 -0
  13. package/dist/assets/MonacoEditor-CEYP9b6u.js +2 -0
  14. package/dist/assets/NewButtonModal-5nQ-f2by.js +1 -0
  15. package/dist/assets/NewGroupModal-vEuxSpnD.js +1 -0
  16. package/dist/assets/NewTabModal-DNzMru8E.js +1 -0
  17. package/dist/assets/RuleEditorPanel-B0u4b6vi.js +1 -0
  18. package/dist/assets/ScriptView-Ct4i8Jja.js +1 -0
  19. package/dist/assets/TabDisplayRulesPanel-HMmGkIxe.js +1 -0
  20. package/dist/assets/TranslationsView-DT4Ce3_W.js +1 -0
  21. package/dist/assets/WebResourceBrowser-L3R7UTNR.js +1 -0
  22. package/dist/assets/XmlView-CyLtgYex.js +2 -0
  23. package/dist/assets/{dnd-C1w9VFfC.js → dnd-iy5K5XAJ.js} +2 -2
  24. package/dist/assets/fluent-ui-CQyNN9H3.js +59 -0
  25. package/dist/assets/index-D7TexD30.js +136 -0
  26. package/dist/assets/monaco-DQA8g3bM.css +1 -0
  27. package/dist/assets/monaco-cQE5XS3B.js +1010 -0
  28. package/dist/assets/monacoSetup-BIq1zGyP.js +1 -0
  29. package/dist/assets/preload-helper-PPVm8Dsz.js +1 -0
  30. package/dist/assets/{server.browser-xEJRzS2D.js → server.browser-DTeSoizu.js} +1 -1
  31. package/dist/assets/useReplaceWebResourceConfirm-BdTw98QF.js +1 -0
  32. package/dist/assets/useStableKeys-49o4VnxU.js +1 -0
  33. package/dist/assets/{xmlValidator-PbODaIQV.js → xmlValidator-xIq-x9Ub.js} +2 -2
  34. package/dist/icons/icon.svg +4 -7
  35. package/dist/index.html +4 -6
  36. package/package.json +3 -1
  37. package/dist/assets/BulkPublishModal-DzDZJg0U.js +0 -36
  38. package/dist/assets/CommandEditorPanel-DsCP9yG4.js +0 -1
  39. package/dist/assets/CommandPalette-ID3kRJ9l.js +0 -1
  40. package/dist/assets/CompareView-DGsrcdoN.js +0 -7
  41. package/dist/assets/CrmParameterEditor-C22QGWff.js +0 -1
  42. package/dist/assets/EditorDrawer-CvCe9WeO.js +0 -2
  43. package/dist/assets/HideInsteadOfDeleteModal-3j9g-E9l.js +0 -1
  44. package/dist/assets/IconPickerModal-BLoDLbLR.js +0 -1
  45. package/dist/assets/ImportXmlModal-BD-L1QzJ.js +0 -1
  46. package/dist/assets/MonacoEditor-BMKRZv-g.js +0 -2
  47. package/dist/assets/NewButtonModal-COYXwEyk.js +0 -1
  48. package/dist/assets/NewGroupModal-boP_t1fI.js +0 -1
  49. package/dist/assets/NewTabModal-BI4afbC5.js +0 -1
  50. package/dist/assets/RuleEditorPanel-l8QnRFj6.js +0 -1
  51. package/dist/assets/ScriptView-BVyCmRvD.js +0 -1
  52. package/dist/assets/TabDisplayRulesPanel-gORq6MO7.js +0 -1
  53. package/dist/assets/TranslationsView-DubBATog.js +0 -1
  54. package/dist/assets/WebResourceBrowser-BATScmTw.js +0 -1
  55. package/dist/assets/XmlView-Bn4KlTw3.js +0 -2
  56. package/dist/assets/abap-DLDM7-KI.js +0 -1
  57. package/dist/assets/apex-DNDY2TF8.js +0 -1
  58. package/dist/assets/azcli-Y6nb8tq_.js +0 -1
  59. package/dist/assets/bat-BwHxbl9M.js +0 -1
  60. package/dist/assets/bicep-CFznDFnq.js +0 -2
  61. package/dist/assets/cameligo-Bf6VGUru.js +0 -1
  62. package/dist/assets/clojure-Dnu-v4kV.js +0 -1
  63. package/dist/assets/coffee-Bd8akH9Z.js +0 -1
  64. package/dist/assets/cpp-BbWJElDN.js +0 -1
  65. package/dist/assets/csharp-Co3qMtFm.js +0 -1
  66. package/dist/assets/csp-D-4FJmMZ.js +0 -1
  67. package/dist/assets/css-DdJfP1eB.js +0 -3
  68. package/dist/assets/css.worker-C_6RgliQ.js +0 -97
  69. package/dist/assets/cssMode-yNaVDuBb.js +0 -1
  70. package/dist/assets/cypher-cTPe9QuQ.js +0 -1
  71. package/dist/assets/dart-BOtBlQCF.js +0 -1
  72. package/dist/assets/dockerfile-BG73LgW2.js +0 -1
  73. package/dist/assets/ecl-BEgZUVRK.js +0 -1
  74. package/dist/assets/elixir-BkW5O-1t.js +0 -1
  75. package/dist/assets/flow9-BeJ5waoc.js +0 -1
  76. package/dist/assets/fluent-icons-CQEhzzaC.js +0 -1
  77. package/dist/assets/fluent-ui-BEjALNLO.js +0 -59
  78. package/dist/assets/freemarker2-CzWSO7cF.js +0 -3
  79. package/dist/assets/fsharp-PahG7c26.js +0 -1
  80. package/dist/assets/go-acbASCJo.js +0 -1
  81. package/dist/assets/graphql-BxJiqAUM.js +0 -1
  82. package/dist/assets/handlebars-BpG2O9CH.js +0 -1
  83. package/dist/assets/hcl-DtV1sZF8.js +0 -1
  84. package/dist/assets/html-Bm7ESfBq.js +0 -1
  85. package/dist/assets/html.worker-CLyYFd_g.js +0 -474
  86. package/dist/assets/htmlMode--CmpAV7s.js +0 -1
  87. package/dist/assets/index-6so8O90C.js +0 -136
  88. package/dist/assets/ini-Kd9XrMLS.js +0 -1
  89. package/dist/assets/java-CXBNlu9o.js +0 -1
  90. package/dist/assets/javascript-DYy3TIq5.js +0 -1
  91. package/dist/assets/json.worker-BggoxaER.js +0 -62
  92. package/dist/assets/jsonMode-DwsyQ3o1.js +0 -7
  93. package/dist/assets/julia-cl7-CwDS.js +0 -1
  94. package/dist/assets/kotlin-s7OhZKlX.js +0 -1
  95. package/dist/assets/less-9HpZscsL.js +0 -2
  96. package/dist/assets/lexon-OrD6JF1K.js +0 -1
  97. package/dist/assets/liquid-qkuWCPaY.js +0 -1
  98. package/dist/assets/lspLanguageFeatures-Cgd9CNvq.js +0 -4
  99. package/dist/assets/lua-Cyyb5UIc.js +0 -1
  100. package/dist/assets/m3-B8OfTtLu.js +0 -1
  101. package/dist/assets/markdown-BFxVWTOG.js +0 -1
  102. package/dist/assets/mdx-CtHfOclF.js +0 -1
  103. package/dist/assets/mips-CiqrrVzr.js +0 -1
  104. package/dist/assets/monaco-BIO15LCS.js +0 -1005
  105. package/dist/assets/monaco-DdLsZAcA.css +0 -1
  106. package/dist/assets/msdax-DmeGPVcC.js +0 -1
  107. package/dist/assets/mysql-C_tMU-Nz.js +0 -1
  108. package/dist/assets/objective-c-BDtDVThU.js +0 -1
  109. package/dist/assets/pascal-vHIfCaH5.js +0 -1
  110. package/dist/assets/pascaligo-DtZ0uQbO.js +0 -1
  111. package/dist/assets/perl-Ub6l9XKa.js +0 -1
  112. package/dist/assets/pgsql-BlNEE0v7.js +0 -1
  113. package/dist/assets/php-BBUBE1dy.js +0 -1
  114. package/dist/assets/pla-DSh2-awV.js +0 -1
  115. package/dist/assets/postiats-CocnycG-.js +0 -1
  116. package/dist/assets/powerquery-tScXyioY.js +0 -1
  117. package/dist/assets/powershell-COWaemsV.js +0 -1
  118. package/dist/assets/protobuf-Brw8urJB.js +0 -2
  119. package/dist/assets/pug-8SOpv6rk.js +0 -1
  120. package/dist/assets/python-CazlH6B-.js +0 -1
  121. package/dist/assets/qsharp-Bw9ernYp.js +0 -1
  122. package/dist/assets/r-j7ic8hl3.js +0 -1
  123. package/dist/assets/razor-BfGfB6aB.js +0 -1
  124. package/dist/assets/redis-Bu5POkcn.js +0 -1
  125. package/dist/assets/redshift-Bs9aos_-.js +0 -1
  126. package/dist/assets/restructuredtext-CqXO7rUv.js +0 -1
  127. package/dist/assets/ruby-zBfavPgS.js +0 -1
  128. package/dist/assets/rust-BzKRNQWT.js +0 -1
  129. package/dist/assets/sb-BBc9UKZt.js +0 -1
  130. package/dist/assets/scala-D9hQfWCl.js +0 -1
  131. package/dist/assets/scheme-BPhDTwHR.js +0 -1
  132. package/dist/assets/scss-CBJaRo0y.js +0 -3
  133. package/dist/assets/shell-DiJ1NA_G.js +0 -1
  134. package/dist/assets/solidity-Db0IVjzk.js +0 -1
  135. package/dist/assets/sophia-CnS9iZB_.js +0 -1
  136. package/dist/assets/sparql-CJmd_6j2.js +0 -1
  137. package/dist/assets/sql-ClhHkBeG.js +0 -1
  138. package/dist/assets/st-CHwy0fLd.js +0 -1
  139. package/dist/assets/swift-CnmFD0ga.js +0 -1
  140. package/dist/assets/systemverilog-Bs9z6M-B.js +0 -1
  141. package/dist/assets/tcl-Dm6ycUr_.js +0 -1
  142. package/dist/assets/tsMode-BZv6gTt6.js +0 -11
  143. package/dist/assets/twig-Csy3S7wG.js +0 -1
  144. package/dist/assets/typescript-BgDL1fzP.js +0 -1
  145. package/dist/assets/typespec-Btyra-wh.js +0 -1
  146. package/dist/assets/useReplaceWebResourceConfirm-DND-V0vw.js +0 -1
  147. package/dist/assets/useStableKeys-BkDn7til.js +0 -1
  148. package/dist/assets/vb-Db0cS2oM.js +0 -1
  149. package/dist/assets/wgsl-BTesnYfV.js +0 -298
  150. package/dist/assets/workers-BZ4mXA5s.js +0 -1
  151. package/dist/assets/xml-Cl6spsD4.js +0 -1
  152. package/dist/assets/yaml-El-x4GhS.js +0 -1
@@ -0,0 +1 @@
1
+ import{l as o,m as e,W as a,a as n}from"./monaco-cQE5XS3B.js";import"./fluent-ui-CQyNN9H3.js";import"./preload-helper-PPVm8Dsz.js";o.config({monaco:e});self.MonacoEnvironment={getWorker(p,r){return r==="typescript"||r==="javascript"?new a:new n}};
@@ -0,0 +1 @@
1
+ const p="modulepreload",y=function(u,i){return new URL(u,i).href},v={},w=function(i,a,f){let d=Promise.resolve();if(a&&a.length>0){let E=function(e){return Promise.all(e.map(o=>Promise.resolve(o).then(s=>({status:"fulfilled",value:s}),s=>({status:"rejected",reason:s}))))};const r=document.getElementsByTagName("link"),t=document.querySelector("meta[property=csp-nonce]"),m=t?.nonce||t?.getAttribute("nonce");d=E(a.map(e=>{if(e=y(e,f),e in v)return;v[e]=!0;const o=e.endsWith(".css"),s=o?'[rel="stylesheet"]':"";if(f)for(let c=r.length-1;c>=0;c--){const l=r[c];if(l.href===e&&(!o||l.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${e}"]${s}`))return;const n=document.createElement("link");if(n.rel=o?"stylesheet":p,o||(n.as="script"),n.crossOrigin="",n.href=e,m&&n.setAttribute("nonce",m),document.head.appendChild(n),o)return new Promise((c,l)=>{n.addEventListener("load",c),n.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${e}`)))})}))}function h(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&h(t.reason);return i().catch(h)})};export{w as _};
@@ -1,4 +1,4 @@
1
- import{r as Kr}from"./monaco-BIO15LCS.js";function cn($,m){for(var F=0;F<m.length;F++){const B=m[F];if(typeof B!="string"&&!Array.isArray(B)){for(const v in B)if(v!=="default"&&!(v in $)){const R=Object.getOwnPropertyDescriptor(B,v);R&&Object.defineProperty($,v,R.get?R:{enumerable:!0,get:()=>B[v]})}}}return Object.freeze(Object.defineProperty($,Symbol.toStringTag,{value:"Module"}))}var he={},Re={};var Gr;function fn(){if(Gr)return Re;Gr=1;var $=Kr();function m(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,l=1;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var F=Object.prototype.hasOwnProperty,B=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v={},R={};function Ae(e){return F.call(R,e)?!0:F.call(v,e)?!1:B.test(e)?R[e]=!0:(v[e]=!0,!1)}function N(e,n,l,s,f,i,p){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=s,this.attributeNamespace=f,this.mustUseProperty=l,this.propertyName=e,this.type=n,this.sanitizeURL=i,this.removeEmptyString=p}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){S[e]=new N(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];S[n]=new N(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){S[e]=new N(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){S[e]=new N(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){S[e]=new N(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){S[e]=new N(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){S[e]=new N(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){S[e]=new N(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){S[e]=new N(e,5,!1,e.toLowerCase(),null,!1,!1)});var g=/[\-:]([a-z])/g;function _e(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(g,_e);S[n]=new N(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(g,_e);S[n]=new N(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(g,_e);S[n]=new N(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){S[e]=new N(e,1,!1,e.toLowerCase(),null,!1,!1)}),S.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){S[e]=new N(e,1,!1,e.toLowerCase(),null,!0,!0)});var z={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},sr=["Webkit","ms","Moz","O"];Object.keys(z).forEach(function(e){sr.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),z[n]=z[e]})});var gt=/["'&<>]/;function O(e){if(typeof e=="boolean"||typeof e=="number")return""+e;e=""+e;var n=gt.exec(e);if(n){var l="",s,f=0;for(s=n.index;s<e.length;s++){switch(e.charCodeAt(s)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 39:n="&#x27;";break;case 60:n="&lt;";break;case 62:n="&gt;";break;default:continue}f!==s&&(l+=e.substring(f,s)),f=s+1,l+=n}e=f!==s?l+e.substring(f,s):l}return e}var vt=/([A-Z])/g,L=/^ms-/,b=Array.isArray;function U(e,n){return{insertionMode:e,selectedValue:n}}function He(e,n,l){switch(n){case"select":return U(1,l.value!=null?l.value:l.defaultValue);case"svg":return U(2,null);case"math":return U(3,null);case"foreignObject":return U(1,null);case"table":return U(4,null);case"thead":case"tbody":case"tfoot":return U(5,null);case"colgroup":return U(7,null);case"tr":return U(6,null)}return 4<=e.insertionMode||e.insertionMode===0?U(1,null):e}var me=new Map;function St(e,n,l){if(typeof l!="object")throw Error(m(62));n=!0;for(var s in l)if(F.call(l,s)){var f=l[s];if(f!=null&&typeof f!="boolean"&&f!==""){if(s.indexOf("--")===0){var i=O(s);f=O((""+f).trim())}else{i=s;var p=me.get(i);p!==void 0||(p=O(i.replace(vt,"-$1").toLowerCase().replace(L,"-ms-")),me.set(i,p)),i=p,f=typeof f=="number"?f===0||F.call(z,s)?""+f:f+"px":O((""+f).trim())}n?(n=!1,e.push(' style="',i,":",f)):e.push(";",i,":",f)}}n||e.push('"')}function j(e,n,l,s){switch(l){case"style":St(e,n,s);return;case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":return}if(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N"){if(n=S.hasOwnProperty(l)?S[l]:null,n!==null){switch(typeof s){case"function":case"symbol":return;case"boolean":if(!n.acceptsBooleans)return}switch(l=n.attributeName,n.type){case 3:s&&e.push(" ",l,'=""');break;case 4:s===!0?e.push(" ",l,'=""'):s!==!1&&e.push(" ",l,'="',O(s),'"');break;case 5:isNaN(s)||e.push(" ",l,'="',O(s),'"');break;case 6:!isNaN(s)&&1<=s&&e.push(" ",l,'="',O(s),'"');break;default:n.sanitizeURL&&(s=""+s),e.push(" ",l,'="',O(s),'"')}}else if(Ae(l)){switch(typeof s){case"function":case"symbol":return;case"boolean":if(n=l.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-")return}e.push(" ",l,'="',O(s),'"')}}}function D(e,n,l){if(n!=null){if(l!=null)throw Error(m(60));if(typeof n!="object"||!("__html"in n))throw Error(m(61));n=n.__html,n!=null&&e.push(""+n)}}function ir(e){var n="";return $.Children.forEach(e,function(l){l!=null&&(n+=l)}),n}function Ue(e,n,l,s){e.push(X(l));var f=l=null,i;for(i in n)if(F.call(n,i)){var p=n[i];if(p!=null)switch(i){case"children":l=p;break;case"dangerouslySetInnerHTML":f=p;break;default:j(e,s,i,p)}}return e.push(">"),D(e,f,l),typeof l=="string"?(e.push(O(l)),null):l}var We=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,xt=new Map;function X(e){var n=xt.get(e);if(n===void 0){if(!We.test(e))throw Error(m(65,e));n="<"+e,xt.set(e,n)}return n}function ar(e,n,l,s,f){switch(n){case"select":e.push(X("select"));var i=null,p=null;for(C in l)if(F.call(l,C)){var y=l[C];if(y!=null)switch(C){case"children":i=y;break;case"dangerouslySetInnerHTML":p=y;break;case"defaultValue":case"value":break;default:j(e,s,C,y)}}return e.push(">"),D(e,p,i),i;case"option":p=f.selectedValue,e.push(X("option"));var x=y=null,w=null,C=null;for(i in l)if(F.call(l,i)){var M=l[i];if(M!=null)switch(i){case"children":y=M;break;case"selected":w=M;break;case"dangerouslySetInnerHTML":C=M;break;case"value":x=M;default:j(e,s,i,M)}}if(p!=null)if(l=x!==null?""+x:ir(y),b(p)){for(s=0;s<p.length;s++)if(""+p[s]===l){e.push(' selected=""');break}}else""+p===l&&e.push(' selected=""');else w&&e.push(' selected=""');return e.push(">"),D(e,C,y),y;case"textarea":e.push(X("textarea")),C=p=i=null;for(y in l)if(F.call(l,y)&&(x=l[y],x!=null))switch(y){case"children":C=x;break;case"value":i=x;break;case"defaultValue":p=x;break;case"dangerouslySetInnerHTML":throw Error(m(91));default:j(e,s,y,x)}if(i===null&&p!==null&&(i=p),e.push(">"),C!=null){if(i!=null)throw Error(m(92));if(b(C)&&1<C.length)throw Error(m(93));i=""+C}return typeof i=="string"&&i[0]===`
1
+ import{eS as Kr}from"./fluent-ui-CQyNN9H3.js";function cn($,m){for(var F=0;F<m.length;F++){const B=m[F];if(typeof B!="string"&&!Array.isArray(B)){for(const v in B)if(v!=="default"&&!(v in $)){const R=Object.getOwnPropertyDescriptor(B,v);R&&Object.defineProperty($,v,R.get?R:{enumerable:!0,get:()=>B[v]})}}}return Object.freeze(Object.defineProperty($,Symbol.toStringTag,{value:"Module"}))}var he={},Re={};var Gr;function fn(){if(Gr)return Re;Gr=1;var $=Kr();function m(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,l=1;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var F=Object.prototype.hasOwnProperty,B=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v={},R={};function Ae(e){return F.call(R,e)?!0:F.call(v,e)?!1:B.test(e)?R[e]=!0:(v[e]=!0,!1)}function N(e,n,l,s,f,i,p){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=s,this.attributeNamespace=f,this.mustUseProperty=l,this.propertyName=e,this.type=n,this.sanitizeURL=i,this.removeEmptyString=p}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){S[e]=new N(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];S[n]=new N(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){S[e]=new N(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){S[e]=new N(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){S[e]=new N(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){S[e]=new N(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){S[e]=new N(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){S[e]=new N(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){S[e]=new N(e,5,!1,e.toLowerCase(),null,!1,!1)});var g=/[\-:]([a-z])/g;function _e(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(g,_e);S[n]=new N(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(g,_e);S[n]=new N(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(g,_e);S[n]=new N(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){S[e]=new N(e,1,!1,e.toLowerCase(),null,!1,!1)}),S.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){S[e]=new N(e,1,!1,e.toLowerCase(),null,!0,!0)});var z={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},sr=["Webkit","ms","Moz","O"];Object.keys(z).forEach(function(e){sr.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),z[n]=z[e]})});var gt=/["'&<>]/;function O(e){if(typeof e=="boolean"||typeof e=="number")return""+e;e=""+e;var n=gt.exec(e);if(n){var l="",s,f=0;for(s=n.index;s<e.length;s++){switch(e.charCodeAt(s)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 39:n="&#x27;";break;case 60:n="&lt;";break;case 62:n="&gt;";break;default:continue}f!==s&&(l+=e.substring(f,s)),f=s+1,l+=n}e=f!==s?l+e.substring(f,s):l}return e}var vt=/([A-Z])/g,L=/^ms-/,b=Array.isArray;function U(e,n){return{insertionMode:e,selectedValue:n}}function He(e,n,l){switch(n){case"select":return U(1,l.value!=null?l.value:l.defaultValue);case"svg":return U(2,null);case"math":return U(3,null);case"foreignObject":return U(1,null);case"table":return U(4,null);case"thead":case"tbody":case"tfoot":return U(5,null);case"colgroup":return U(7,null);case"tr":return U(6,null)}return 4<=e.insertionMode||e.insertionMode===0?U(1,null):e}var me=new Map;function St(e,n,l){if(typeof l!="object")throw Error(m(62));n=!0;for(var s in l)if(F.call(l,s)){var f=l[s];if(f!=null&&typeof f!="boolean"&&f!==""){if(s.indexOf("--")===0){var i=O(s);f=O((""+f).trim())}else{i=s;var p=me.get(i);p!==void 0||(p=O(i.replace(vt,"-$1").toLowerCase().replace(L,"-ms-")),me.set(i,p)),i=p,f=typeof f=="number"?f===0||F.call(z,s)?""+f:f+"px":O((""+f).trim())}n?(n=!1,e.push(' style="',i,":",f)):e.push(";",i,":",f)}}n||e.push('"')}function j(e,n,l,s){switch(l){case"style":St(e,n,s);return;case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":return}if(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N"){if(n=S.hasOwnProperty(l)?S[l]:null,n!==null){switch(typeof s){case"function":case"symbol":return;case"boolean":if(!n.acceptsBooleans)return}switch(l=n.attributeName,n.type){case 3:s&&e.push(" ",l,'=""');break;case 4:s===!0?e.push(" ",l,'=""'):s!==!1&&e.push(" ",l,'="',O(s),'"');break;case 5:isNaN(s)||e.push(" ",l,'="',O(s),'"');break;case 6:!isNaN(s)&&1<=s&&e.push(" ",l,'="',O(s),'"');break;default:n.sanitizeURL&&(s=""+s),e.push(" ",l,'="',O(s),'"')}}else if(Ae(l)){switch(typeof s){case"function":case"symbol":return;case"boolean":if(n=l.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-")return}e.push(" ",l,'="',O(s),'"')}}}function D(e,n,l){if(n!=null){if(l!=null)throw Error(m(60));if(typeof n!="object"||!("__html"in n))throw Error(m(61));n=n.__html,n!=null&&e.push(""+n)}}function ir(e){var n="";return $.Children.forEach(e,function(l){l!=null&&(n+=l)}),n}function Ue(e,n,l,s){e.push(X(l));var f=l=null,i;for(i in n)if(F.call(n,i)){var p=n[i];if(p!=null)switch(i){case"children":l=p;break;case"dangerouslySetInnerHTML":f=p;break;default:j(e,s,i,p)}}return e.push(">"),D(e,f,l),typeof l=="string"?(e.push(O(l)),null):l}var We=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,xt=new Map;function X(e){var n=xt.get(e);if(n===void 0){if(!We.test(e))throw Error(m(65,e));n="<"+e,xt.set(e,n)}return n}function ar(e,n,l,s,f){switch(n){case"select":e.push(X("select"));var i=null,p=null;for(C in l)if(F.call(l,C)){var y=l[C];if(y!=null)switch(C){case"children":i=y;break;case"dangerouslySetInnerHTML":p=y;break;case"defaultValue":case"value":break;default:j(e,s,C,y)}}return e.push(">"),D(e,p,i),i;case"option":p=f.selectedValue,e.push(X("option"));var x=y=null,w=null,C=null;for(i in l)if(F.call(l,i)){var M=l[i];if(M!=null)switch(i){case"children":y=M;break;case"selected":w=M;break;case"dangerouslySetInnerHTML":C=M;break;case"value":x=M;default:j(e,s,i,M)}}if(p!=null)if(l=x!==null?""+x:ir(y),b(p)){for(s=0;s<p.length;s++)if(""+p[s]===l){e.push(' selected=""');break}}else""+p===l&&e.push(' selected=""');else w&&e.push(' selected=""');return e.push(">"),D(e,C,y),y;case"textarea":e.push(X("textarea")),C=p=i=null;for(y in l)if(F.call(l,y)&&(x=l[y],x!=null))switch(y){case"children":C=x;break;case"value":i=x;break;case"defaultValue":p=x;break;case"dangerouslySetInnerHTML":throw Error(m(91));default:j(e,s,y,x)}if(i===null&&p!==null&&(i=p),e.push(">"),C!=null){if(i!=null)throw Error(m(92));if(b(C)&&1<C.length)throw Error(m(93));i=""+C}return typeof i=="string"&&i[0]===`
2
2
  `&&e.push(`
3
3
  `),i!==null&&e.push(O(""+i)),null;case"input":e.push(X("input")),x=C=y=i=null;for(p in l)if(F.call(l,p)&&(w=l[p],w!=null))switch(p){case"children":case"dangerouslySetInnerHTML":throw Error(m(399,"input"));case"defaultChecked":x=w;break;case"defaultValue":y=w;break;case"checked":C=w;break;case"value":i=w;break;default:j(e,s,p,w)}return C!==null?j(e,s,"checked",C):x!==null&&j(e,s,"checked",x),i!==null?j(e,s,"value",i):y!==null&&j(e,s,"value",y),e.push("/>"),null;case"menuitem":e.push(X("menuitem"));for(var K in l)if(F.call(l,K)&&(i=l[K],i!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(m(400));default:j(e,s,K,i)}return e.push(">"),null;case"title":e.push(X("title")),i=null;for(M in l)if(F.call(l,M)&&(p=l[M],p!=null))switch(M){case"children":i=p;break;case"dangerouslySetInnerHTML":throw Error(m(434));default:j(e,s,M,p)}return e.push(">"),i;case"listing":case"pre":e.push(X(n)),p=i=null;for(x in l)if(F.call(l,x)&&(y=l[x],y!=null))switch(x){case"children":i=y;break;case"dangerouslySetInnerHTML":p=y;break;default:j(e,s,x,y)}if(e.push(">"),p!=null){if(i!=null)throw Error(m(60));if(typeof p!="object"||!("__html"in p))throw Error(m(61));l=p.__html,l!=null&&(typeof l=="string"&&0<l.length&&l[0]===`
4
4
  `?e.push(`
@@ -0,0 +1 @@
1
+ import{r,j as e,D as g,f as x,g as m,h,n as j,t as f,c as l,o as y,k as o}from"./fluent-ui-CQyNN9H3.js";import{S as b,at as k}from"./index-D7TexD30.js";function w(){const[n,t]=r.useState(null),c=r.useRef(null),d=b(a=>a.connectionVersion),s=r.useCallback(a=>{c.current?.(a),c.current=null,t(null)},[]),p=r.useCallback(a=>new Promise(i=>{c.current?.("cancel"),c.current=i,t({name:a.name,managed:a.managed})}),[]);r.useEffect(()=>()=>s("cancel"),[d,s]);const u=e.jsx(g,{open:n!==null,onOpenChange:(a,i)=>!i.open&&s("cancel"),children:e.jsx(x,{style:{maxWidth:520},children:e.jsxs(m,{children:[e.jsx(h,{children:n?.managed?"Use the existing web resource?":"Replace the existing web resource?"}),e.jsxs(j,{style:{display:"flex",flexDirection:"column",gap:f.spacingVerticalS},children:[n?.managed?e.jsxs(l,{children:["A managed web resource named ",e.jsx("strong",{children:n.name})," already exists. It can't be replaced: keep it as it is, or rename the file and upload it again."]}):e.jsxs(l,{children:["A web resource named ",e.jsx("strong",{children:n?.name})," already exists. Replacing it changes its content everywhere it is used (other ribbons, forms, apps)."]}),e.jsx(k,{prefix:"In"})]}),e.jsxs(y,{children:[e.jsx(o,{appearance:"secondary",onClick:()=>s("cancel"),children:"Cancel"}),e.jsx(o,{appearance:n?.managed?"primary":"secondary",onClick:()=>s("keep"),children:"Keep existing"}),!n?.managed&&e.jsx(o,{appearance:"primary",onClick:()=>s("replace"),children:"Replace"})]})]})})});return{onExisting:p,dialog:u}}export{w as u};
@@ -0,0 +1 @@
1
+ import{r as d}from"./fluent-ui-CQyNN9H3.js";import{g as y}from"./dnd-iy5K5XAJ.js";let c=0;const g=(n,t)=>Array.from({length:t},()=>`${n}#${++c}`);function p(n,t){const[e,a]=d.useState(null),f=d.useMemo(()=>g(n,t.length),[n,t]),l=!!e&&e.scope===n&&e.keys.length===t.length&&(e.items===t||e.pending);e?.pending&&a({...e,items:l?t:e.items,pending:!1});const r=l?e.keys:f,o=s=>a({scope:n,items:t,pending:!0,keys:s});return{keys:r,add:()=>o([...r,...g(n,1)]),remove:s=>o(r.filter((u,i)=>i!==s)),move:(s,u)=>o(y(r,s,u)),update:()=>o(r)}}export{p as u};
@@ -1,3 +1,3 @@
1
- import{a1 as v,a2 as ie,a3 as re,a4 as V,a5 as le,p as ce}from"./index-6so8O90C.js";import{D as ue,E as me}from"./ruleKinds-BKTUiZ1-.js";import{C as de,i as fe}from"./crmParameters-rgfZhhzN.js";const pe=/^[a-zA-Z_$][a-zA-Z_$0-9.]*$/,he=/^[a-zA-Z_][a-zA-Z_0-9]*$/,ge=/^[+-]?\d+$/,be=/^[+-]?(\d+(\.\d*)?|\.\d+)$/,H=/^(true|false|1|0)$/,W={JavaScriptFunction:["FunctionName","Library"],Url:["Address"],CustomRule:["FunctionName","Library"],CommandClientTypeRule:["Type"],CrmClientTypeRule:["Type"],CrmOfflineAccessStateRule:["State"],CrmOutlookClientTypeRule:["Type"],CrmOutlookClientVersionRule:["Major"],DeviceTypeRule:["Type"],EntityPrivilegeRule:["PrivilegeType","PrivilegeDepth"],EntityPropertyRule:["PropertyName","PropertyValue"],FeatureControlRule:["FeatureControlBit","ExpectedValue"],FormEntityContextRule:["EntityName"],FormStateRule:["State"],FormTypeRule:["Type"],MiscellaneousPrivilegeRule:["PrivilegeName"],OptionSetRule:["OptionSet","StateCode","ObjectTypeCode"],OrganizationSettingRule:["Setting"],OutlookItemTrackingRule:["TrackedInCrm"],OutlookRenderTypeRule:["Type"],OutlookVersionRule:["Version"],PageRule:["Address"],RecordPrivilegeRule:["PrivilegeType"],RelationshipTypeRule:["AppliesTo"],SkuRule:["Sku"],ValueRule:["Field","Value"],BoolParameter:["Value"],CrmParameter:["Value"],DecimalParameter:["Value"],IntParameter:["Value"],StringParameter:["Value"]},ye=new Set(["ValueRule.Value","StringParameter.Value"]),$e={SelectionCountRule:["Minimum","Maximum"],CrmOutlookClientVersionRule:["Major","Minor","Build","Revision"],IntParameter:["Value"],Url:["WinMode"]},Ae={DecimalParameter:["Value"]},Re={BoolParameter:["Value"],Url:["PassParams"],OutlookItemTrackingRule:["TrackedInCrm"],EntityPropertyRule:["PropertyValue"],FeatureControlRule:["ExpectedValue"],RelationshipTypeRule:["AllowCustomRelationship","AllowSystemRelationship"]},Se=["Default","InvertResult"],Ie=new Set(["BoolParameter","CrmParameter","DecimalParameter","IntParameter","StringParameter"]),O=s=>Array.from(s.children);function q(s,l,g){const u=[],f=s.tagName;for(const p of W[f]??[]){const m=s.getAttribute(p);(m===null||!m.trim()&&!ye.has(`${f}.${p}`))&&u.push(`${l}: ${f} has no ${p}`)}const b=(p,m,i)=>{for(const d of p??[]){const R=s.getAttribute(d);R===null||R===""&&W[f]?.includes(d)||m.test(R.trim())||u.push(`${l}: ${f} ${d}="${R}" is not ${i}`)}};if(b($e[f],ge,"a whole number"),b(Ae[f],be,"a number"),b(Re[f],H,"true or false"),g&&b(Se,H,"true or false"),f==="JavaScriptFunction"||f==="CustomRule"){const p=s.getAttribute("FunctionName");p?.trim()&&!pe.test(p)&&u.push(`${l}: FunctionName "${p}" isn't a JavaScript function name (letters, digits, _, $ and dots)`)}if((f==="JavaScriptFunction"||f==="CustomRule")&&/^\$webresource:\s*$/i.test(s.getAttribute("Library")??"")&&u.push(`${l}: ${f} Library names no web resource`),f==="EntityRule"){const p=s.getAttribute("Context");p!==null&&!he.test(p)&&u.push(`${l}: EntityRule Context "${p}" isn't valid`)}f==="Url"&&/^https?:\/\/$/i.test(s.getAttribute("Address")?.trim()??"")&&u.push(`${l}: Url has no address`);for(const p of O(s).filter(m=>Ie.has(m.tagName)))f==="Url"&&!p.getAttribute("Name")?.trim()&&u.push(`${l}: a ${p.tagName} of the Url has no Name`),f!=="Url"&&p.hasAttribute("Name")&&u.push(`${l}: a ${p.tagName} of ${f} can't have a Name`),u.push(...q(p,l,!1));return u}function we(s){const l=s.getAttribute("Id")??"";if(s.tagName==="CommandDefinition"){const b=`Command ${l}`,p=O(s).find(m=>m.tagName==="Actions");return O(p??s).filter(m=>m.tagName==="JavaScriptFunction"||m.tagName==="Url").flatMap(m=>q(m,b,!1))}if(s.tagName!=="EnableRule"&&s.tagName!=="DisplayRule")return[];const g=`${s.tagName==="EnableRule"?"Enable":"Display"} rule ${l}`,u=O(s);if(u.length===0)return[`${g} has no steps — add one, or remove the rule from its commands`];const f=[];for(const b of u){if(b.tagName!=="OrRule"){f.push(...q(b,g,!0));continue}const p=O(b).filter(m=>m.tagName==="Or");p.length<2&&f.push(`${g}: an OrRule needs at least 2 alternatives (it has ${p.length})`);for(const m of p){const i=O(m);i.length===0&&f.push(`${g}: an alternative of its OrRule has no steps`);for(const d of i)d.tagName==="OrRule"?f.push(`${g}: an OrRule can't contain another OrRule`):f.push(...q(d,g,!0))}}return f}const Ne=["Mscrm.HideOnModern","Mscrm.ShowOnlyOnModern"];function E(s,l){const g=s.indexOf(l);return g<0?void 0:`Line ${s.slice(0,g).split(/\r?\n/).length}`}function _e(s,l,g){const u=[],b=new DOMParser().parseFromString(s,"application/xml"),p=b.querySelector("parsererror");if(p){const i=(p.textContent??"").replace(/This page contains the following errors:/i,"").replace(/Below is a rendering of the page up to the first error\.?/i,"").trim()||"Unknown",d=i.match(/line\s+(\d+)/i);return u.push({message:`XML parse error: ${i}`,lineHint:d?`Line ${d[1]}`:void 0}),u}const m=new Set([]);return b.querySelectorAll("[Id]").forEach(i=>{const d=i.getAttribute("Id")??"";if(/\s/.test(d)){const R=E(s,`Id="${d}"`);u.push({message:`Element ID "${d}" contains invalid whitespace characters`,elementId:d,lineHint:R})}}),b.querySelectorAll("[LabelText]").forEach(i=>{const d=i.getAttribute("LabelText")??"",R=d.match(/^\$LocLabels:(.+)$/);if(R&&m.size>0&&!m.has(R[1])){const $=i.getAttribute("Id")??"",S=E(s,$?`Id="${$}"`:`LabelText="${d}"`);u.push({message:`Button label reference "$LocLabels:${R[1]}" has no matching LocLabel entry`,elementId:$||void 0,lineHint:S})}}),(s.includes("& ")||s.includes(`&
1
+ import{af as v,ag as ie,ah as re,ai as V,aj as le,p as ce}from"./index-D7TexD30.js";import{D as ue,E as me}from"./ruleKinds-BKTUiZ1-.js";import{C as de,i as fe}from"./crmParameters-rgfZhhzN.js";const pe=/^[a-zA-Z_$][a-zA-Z_$0-9.]*$/,he=/^[a-zA-Z_][a-zA-Z_0-9]*$/,ge=/^[+-]?\d+$/,be=/^[+-]?(\d+(\.\d*)?|\.\d+)$/,H=/^(true|false|1|0)$/,W={JavaScriptFunction:["FunctionName","Library"],Url:["Address"],CustomRule:["FunctionName","Library"],CommandClientTypeRule:["Type"],CrmClientTypeRule:["Type"],CrmOfflineAccessStateRule:["State"],CrmOutlookClientTypeRule:["Type"],CrmOutlookClientVersionRule:["Major"],DeviceTypeRule:["Type"],EntityPrivilegeRule:["PrivilegeType","PrivilegeDepth"],EntityPropertyRule:["PropertyName","PropertyValue"],FeatureControlRule:["FeatureControlBit","ExpectedValue"],FormEntityContextRule:["EntityName"],FormStateRule:["State"],FormTypeRule:["Type"],MiscellaneousPrivilegeRule:["PrivilegeName"],OptionSetRule:["OptionSet","StateCode","ObjectTypeCode"],OrganizationSettingRule:["Setting"],OutlookItemTrackingRule:["TrackedInCrm"],OutlookRenderTypeRule:["Type"],OutlookVersionRule:["Version"],PageRule:["Address"],RecordPrivilegeRule:["PrivilegeType"],RelationshipTypeRule:["AppliesTo"],SkuRule:["Sku"],ValueRule:["Field","Value"],BoolParameter:["Value"],CrmParameter:["Value"],DecimalParameter:["Value"],IntParameter:["Value"],StringParameter:["Value"]},ye=new Set(["ValueRule.Value","StringParameter.Value"]),$e={SelectionCountRule:["Minimum","Maximum"],CrmOutlookClientVersionRule:["Major","Minor","Build","Revision"],IntParameter:["Value"],Url:["WinMode"]},Ae={DecimalParameter:["Value"]},Re={BoolParameter:["Value"],Url:["PassParams"],OutlookItemTrackingRule:["TrackedInCrm"],EntityPropertyRule:["PropertyValue"],FeatureControlRule:["ExpectedValue"],RelationshipTypeRule:["AllowCustomRelationship","AllowSystemRelationship"]},Se=["Default","InvertResult"],Ie=new Set(["BoolParameter","CrmParameter","DecimalParameter","IntParameter","StringParameter"]),O=s=>Array.from(s.children);function q(s,l,g){const u=[],f=s.tagName;for(const p of W[f]??[]){const m=s.getAttribute(p);(m===null||!m.trim()&&!ye.has(`${f}.${p}`))&&u.push(`${l}: ${f} has no ${p}`)}const b=(p,m,i)=>{for(const d of p??[]){const R=s.getAttribute(d);R===null||R===""&&W[f]?.includes(d)||m.test(R.trim())||u.push(`${l}: ${f} ${d}="${R}" is not ${i}`)}};if(b($e[f],ge,"a whole number"),b(Ae[f],be,"a number"),b(Re[f],H,"true or false"),g&&b(Se,H,"true or false"),f==="JavaScriptFunction"||f==="CustomRule"){const p=s.getAttribute("FunctionName");p?.trim()&&!pe.test(p)&&u.push(`${l}: FunctionName "${p}" isn't a JavaScript function name (letters, digits, _, $ and dots)`)}if((f==="JavaScriptFunction"||f==="CustomRule")&&/^\$webresource:\s*$/i.test(s.getAttribute("Library")??"")&&u.push(`${l}: ${f} Library names no web resource`),f==="EntityRule"){const p=s.getAttribute("Context");p!==null&&!he.test(p)&&u.push(`${l}: EntityRule Context "${p}" isn't valid`)}f==="Url"&&/^https?:\/\/$/i.test(s.getAttribute("Address")?.trim()??"")&&u.push(`${l}: Url has no address`);for(const p of O(s).filter(m=>Ie.has(m.tagName)))f==="Url"&&!p.getAttribute("Name")?.trim()&&u.push(`${l}: a ${p.tagName} of the Url has no Name`),f!=="Url"&&p.hasAttribute("Name")&&u.push(`${l}: a ${p.tagName} of ${f} can't have a Name`),u.push(...q(p,l,!1));return u}function we(s){const l=s.getAttribute("Id")??"";if(s.tagName==="CommandDefinition"){const b=`Command ${l}`,p=O(s).find(m=>m.tagName==="Actions");return O(p??s).filter(m=>m.tagName==="JavaScriptFunction"||m.tagName==="Url").flatMap(m=>q(m,b,!1))}if(s.tagName!=="EnableRule"&&s.tagName!=="DisplayRule")return[];const g=`${s.tagName==="EnableRule"?"Enable":"Display"} rule ${l}`,u=O(s);if(u.length===0)return[`${g} has no steps — add one, or remove the rule from its commands`];const f=[];for(const b of u){if(b.tagName!=="OrRule"){f.push(...q(b,g,!0));continue}const p=O(b).filter(m=>m.tagName==="Or");p.length<2&&f.push(`${g}: an OrRule needs at least 2 alternatives (it has ${p.length})`);for(const m of p){const i=O(m);i.length===0&&f.push(`${g}: an alternative of its OrRule has no steps`);for(const d of i)d.tagName==="OrRule"?f.push(`${g}: an OrRule can't contain another OrRule`):f.push(...q(d,g,!0))}}return f}const Ne=["Mscrm.HideOnModern","Mscrm.ShowOnlyOnModern"];function E(s,l){const g=s.indexOf(l);return g<0?void 0:`Line ${s.slice(0,g).split(/\r?\n/).length}`}function _e(s,l,g){const u=[],b=new DOMParser().parseFromString(s,"application/xml"),p=b.querySelector("parsererror");if(p){const i=(p.textContent??"").replace(/This page contains the following errors:/i,"").replace(/Below is a rendering of the page up to the first error\.?/i,"").trim()||"Unknown",d=i.match(/line\s+(\d+)/i);return u.push({message:`XML parse error: ${i}`,lineHint:d?`Line ${d[1]}`:void 0}),u}const m=new Set([]);return b.querySelectorAll("[Id]").forEach(i=>{const d=i.getAttribute("Id")??"";if(/\s/.test(d)){const R=E(s,`Id="${d}"`);u.push({message:`Element ID "${d}" contains invalid whitespace characters`,elementId:d,lineHint:R})}}),b.querySelectorAll("[LabelText]").forEach(i=>{const d=i.getAttribute("LabelText")??"",R=d.match(/^\$LocLabels:(.+)$/);if(R&&m.size>0&&!m.has(R[1])){const $=i.getAttribute("Id")??"",S=E(s,$?`Id="${$}"`:`LabelText="${d}"`);u.push({message:`Button label reference "$LocLabels:${R[1]}" has no matching LocLabel entry`,elementId:$||void 0,lineHint:S})}}),(s.includes("& ")||s.includes(`&
2
2
  `))&&u.push({message:'URL may contain an unescaped "&" — all ampersands in XML must be written as &amp;',lineHint:E(s,"& ")??E(s,`&
3
- `)}),b.querySelectorAll("Group").forEach(i=>{const d=[];i.querySelectorAll(":scope > Controls > Button, :scope > Controls > FlyoutAnchor, :scope > Controls > SplitButton").forEach(R=>{const $=parseInt(R.getAttribute("Sequence")??"0",10);if(d.includes($)){const S=i.getAttribute("Id")??"?";u.push({message:`Two elements share Sequence "${$}" in group "${S}"`,elementId:S,lineHint:E(s,`Sequence="${$}"`)})}d.push($)})}),u.push(...Ee(b,s)),u}const X=new Set(["BoolParameter","CrmParameter","DecimalParameter","IntParameter","StringParameter"]);function A(s){return Array.from(s.children)}function te(s,l){return l==="enable"?ue.has(s):me.has(s)}function Ee(s,l){const g=[],u=(m,i,d)=>g.push({message:m,elementId:d,lineHint:E(l,i)}),f=(m,i,d)=>g.push({message:m,elementId:d,lineHint:E(l,i),severity:"warning"}),b=s.querySelector("RibbonDiffXml > RuleDefinitions"),p=[{tag:"EnableRule",label:"Enable",container:"enable"},{tag:"DisplayRule",label:"Display",container:"display"}];for(const{tag:m,label:i,container:d}of p)b?.querySelectorAll(`:scope > ${m}s > ${m}`).forEach(R=>{const $=R.getAttribute("Id")??"",S=A(R);S.length===0&&u(`${i} rule "${$}" has no steps — the schema requires at least one`,`Id="${$}"`,$);const D=I=>{te(I.tagName,d)&&f(`${i} rule "${$}" contains ${I.tagName}, which RibbonTypes.xsd only allows in ${d==="enable"?"display":"enable"} rules`,`<${I.tagName}`,$)};for(const I of S){if(I.tagName!=="OrRule"){D(I);continue}const T=A(I);T.filter(w=>w.tagName==="Or").length<2&&u(`OrRule in ${i.toLowerCase()} rule "${$}" needs at least 2 <Or> children (found ${T.filter(w=>w.tagName==="Or").length})`,"<OrRule",$);for(const w of T){const C=A(w);C.length===0&&u(`Empty <Or> in rule "${$}"`,"<Or",$);for(const L of C)L.tagName==="OrRule"?u(`Rule "${$}": an <Or> cannot contain another OrRule`,"<OrRule",$):D(L)}}});return b||s.querySelectorAll("OrRule").forEach(m=>{const i=m.querySelectorAll(":scope > Or").length;i<2&&u(`OrRule requires at least 2 <Or> children (found ${i})`,"<OrRule")}),s.querySelectorAll("JavaScriptFunction, CustomRule").forEach(m=>{for(const i of A(m)){if(!X.has(i.tagName))continue;i.hasAttribute("Name")&&u(`${i.tagName} inside <${m.tagName}> must not have a Name attribute (only <Url> parameters are named)`,`<${i.tagName} Name=`);const d=i.getAttribute("Value")??"";i.tagName==="CrmParameter"&&!de.has(d)&&u(`CrmParameter Value "${d}" is not a valid CrmParameterValue`,`Value="${d}"`)}}),s.querySelectorAll("Url").forEach(m=>{for(const i of A(m)){if(!X.has(i.tagName))continue;i.getAttribute("Name")||u(`${i.tagName} inside <Url> requires a Name (the query-string key)`,`<${i.tagName}`);const d=i.getAttribute("Value")??"";i.tagName==="CrmParameter"&&!fe(d)&&u(`CrmParameter Value "${d}" is not allowed in a <Url> action (CrmNamedParameterValue)`,`Value="${d}"`)}}),s.querySelector("RibbonDiffXml > Scalings")&&u('<Scalings> is not allowed in RibbonDiffXml — scaling changes are CustomActions with Location="{tabId}.Scaling._children"',"<Scalings"),s.querySelectorAll("CustomAction > CommandUIDefinition > Tab").forEach(m=>{const i=m.getAttribute("Id")??"",d=A(m).map(S=>S.tagName),R=d.indexOf("Scaling"),$=d.indexOf("Groups");(R<0||$>=0&&R>$)&&u(`Tab "${i}" needs a <Scaling Id> element before <Groups>`,`Id="${i}"`,i)}),s.querySelectorAll("TabDisplayRule > DisplayRules").forEach(()=>{u("TabDisplayRule rules must be direct children — remove the <DisplayRules> wrapper","<TabDisplayRule")}),g}const Te=["LabelText","ToolTipTitle","ToolTipDescription","Alt","Title","Description"],Ce=new Set(["powerFx","customApi"]),Le={powerFx:"Power Fx",customApi:"Custom API"};function ve(s){return[...new Set(s.actions.map(l=>l.kind).filter(l=>Ce.has(l)))]}const K=/^\$LocLabels:(.+)$/,ne=/^\$webresource:([^?#]+)/i,J=new Set(["ModernImage","Image16by16","Image32by32"]),Q=new Set(["Tab","Group"]),oe=new Set(["main_system_library.js"]),Oe=new Set(["FlyoutAnchor","SplitButton"]),Pe=new Set(["Button","FlyoutAnchor","SplitButton","TextBox","ComboBox","CheckBox"]),Y=/^(.+)\.Scaling\._children$/,Z=s=>/^(Mscrm|Microsoft)\./.test(s);function ae(s){const l=[],g=[],u=new DOMParser;for(const f of Object.keys(s))for(const[b,p]of s[f]){const m=u.parseFromString(p,"application/xml");if(m.querySelector("parsererror")){g.push({severity:"error",code:"xml-parse",message:`${f} element ${b} is not well-formed XML`,elementId:b});continue}l.push({part:f,key:`${f}:${b}`,el:m.documentElement})}return{elements:l,errors:g}}function N(s){return[s,...Array.from(s.getElementsByTagName("*"))]}function se(s){return typeof s=="string"?ce(s):s}function Be(s){let l;try{l=se(s)}catch{return[]}const g=new Map;for(const{el:u}of ae(l).elements)for(const f of N(u))for(const b of Array.from(f.attributes)){const p=ne.exec(b.value.trim())?.[1],m=p?.toLowerCase();p&&m&&!oe.has(m)&&!g.has(m)&&g.set(m,p)}return[...g.values()]}const ee=s=>{const l=s.trim();return l&&!l.includes(".")?`Mscrm.Templates.${l}`:l};function qe(s,l={}){let g;try{g=se(s)}catch(e){return[{severity:"error",code:"xml-parse",message:e instanceof Error?e.message:String(e)}]}const{elements:u,errors:f}=ae(g),b=l.changedKeys?new Set(l.changedKeys):null,p=e=>!b||b.has(e),m=new Set(l.newKeys??[]),i=(e,n,t,a,o=!1)=>{const r=(Array.isArray(n)?n:[n]).some(p);f.push({severity:o||!r?"warning":"error",code:e,message:r?t:`${t} (already in the published customizations)`,elementId:a})},d=u.filter(e=>e.part==="customActions"),R=u.filter(e=>e.part==="commandDefinitions");for(const{part:e,key:n,el:t}of u)if(!(e!=="commandDefinitions"&&e!=="enableRules"&&e!=="displayRules"))for(const a of we(t))i("schema",n,a,t.getAttribute("Id")??void 0);const $=new Map((l.commands??[]).map(e=>[e.id,e]));for(const{key:e,el:n}of R){const t=n.getAttribute("Id")??"",a=$.get(t);if(!a||!p(e))continue;const o=ve(a);o.length!==0&&i("dropped-action",e,`Command ${t} has a ${o.map(r=>Le[r]??r).join(" / ")} action — classic ribbon commands can't run it, so it would be dropped; remove the action`,t)}const S=new Set;for(const{el:e}of d)if(e.tagName==="CustomAction")for(const n of Array.from(e.getElementsByTagName("*")))n.getAttribute("Command")===v&&S.add(n.getAttribute("Id")??"");for(const{key:e,el:n}of d){if(n.tagName!=="HideCustomAction")continue;const t=n.getAttribute("Location")??"";!S.has(t)&&!ie({id:t,commandId:v})||i("open-record-hidden",e,`${t} is hidden, but it carries the record open override (${v}) — Unified Interface may then open records as usual or fail to open them; unhide it, or turn the override off`,t,!0)}for(const{key:e,el:n}of R){if(n.getAttribute("Id")!==v)continue;const t=A(n).filter(o=>o.tagName==="DisplayRules").flatMap(o=>A(o).map(r=>r.getAttribute("Id")??r.tagName));if(t.length===0)continue;const a=t.includes("Mscrm.HideOnModern")?Ne.filter(o=>t.includes(o)):[];i("open-record-hidden",e,`${v} has display rules (${t.join(", ")})${a.length>0?` — ${a.join(" + ")} hide its button`:""}: where they hide the "Open record" button, the record open override may stop working; the button must stay shown`,v,!0)}for(const{key:e,el:n}of d)for(const t of Array.from(n.getElementsByTagName("*"))){if(!Oe.has(t.tagName)||A(t).some(o=>o.tagName==="Menu"))continue;const a=t.getAttribute("Id")??"";if(re(t.getAttribute("PopulateDynamically"))){t.getAttribute("PopulateQueryCommand")?.trim()||i("menu-missing",e,`${t.tagName} ${a} is populated dynamically but has no PopulateQueryCommand — its drop-down may stay empty`,a,!0);continue}i("menu-missing",e,`${t.tagName} ${a} has no <Menu> — it would publish as an empty drop-down`,a)}const D=new Set(l.menuControlsIds??[]);for(const{key:e,el:n}of d){const t=n.getAttribute("Location")??"",a=t.endsWith("._children")&&D.has(t.slice(0,-10));for(const o of Array.from(n.getElementsByTagName("*"))){const r=a||!!o.parentElement?.closest("Menu");for(const c of Te){const y=o.getAttribute(c);if(!y?.startsWith("$LocLabels:"))continue;const h=y.slice(11);h.length<=V||i("label-id-length",e,`${o.tagName} ${o.getAttribute("Id")??""} uses label ${h} (${h.length} characters)`+(r?`: a menu item's label id may have at most ${V} characters, or the publish fails after the import — give the control a shorter id`:`: label ids over ${V} characters fail inside menus; consider a shorter control id`),o.getAttribute("Id")??void 0,!r)}}}if(l.known?.commandIds){const e=new Set([...g.commandDefinitions.keys(),...l.known.commandIds]);for(const{key:n,el:t}of d)for(const a of Array.from(t.getElementsByTagName("*")))if(!Q.has(a.tagName))for(const o of["Command","PopulateQueryCommand"]){const r=a.getAttribute(o);if(!r||e.has(r))continue;const c=a.getAttribute("Id")??"";i("undefined-command",n,`${a.tagName} ${c} uses ${o==="Command"?"command":"PopulateQueryCommand"} ${r}, which is defined neither in the customizations nor in the loaded ribbon`,c,Z(r))}}const I={EnableRule:l.known?.enableRuleIds?new Set([...g.enableRules.keys(),...l.known.enableRuleIds]):null,DisplayRule:l.known?.displayRuleIds?new Set([...g.displayRules.keys(),...l.known.displayRuleIds]):null};for(const{key:e,el:n}of R){const t=n.getAttribute("Id")??"",a=A(n).filter(o=>o.tagName==="EnableRules"||o.tagName==="DisplayRules").flatMap(A);for(const o of a){const r=I[o.tagName],c=o.getAttribute("Id");!r||!c||r.has(c)||i("undefined-rule",e,`Command ${t} uses ${o.tagName==="EnableRule"?"enable":"display"} rule ${c}, which is defined neither in the customizations nor in the loaded ribbon`,t,Z(c))}}for(const{part:e,key:n,el:t}of u){if(e!=="enableRules"&&e!=="displayRules")continue;const a=e==="enableRules"?"enable":"display",o=t.getAttribute("Id")??"",r=A(t).flatMap(c=>c.tagName==="OrRule"?A(c).filter(y=>y.tagName==="Or").flatMap(A):[c]);for(const c of r)te(c.tagName,a)&&i("rule-placement",n,`${a==="enable"?"Enable":"Display"} rule ${o} contains ${c.tagName}, which the ribbon schema only allows in ${a==="enable"?"display":"enable"} rules`,o,!0)}const T=new Set;for(const e of Object.values(l.loadedAttributes??{}))for(const n of Object.values(e))K.test(n)&&T.add(n);for(const{key:e,el:n}of u)if(n.tagName!=="LocLabel")for(const t of N(n))for(const a of Array.from(t.attributes)){const o=K.exec(a.value)?.[1];if(!o||g.locLabels.has(o))continue;const r=t.getAttribute("Id")??void 0;r&&l.loadedAttributes?.[r]?.[a.name]===a.value||T.has(a.value)||i("loclabel-missing",e,`${[t.tagName,r,a.name].filter(Boolean).join(" ")} references $LocLabels:${o}, which has no <LocLabel> in these customizations — the text won't resolve unless another solution defines the label`,r,!0)}const w=new Map;for(const{key:e,el:n}of d){const t=n.getAttribute("Location")??"",a=n.getAttribute("Sequence");if(n.tagName!=="CustomAction"||!t.endsWith("._children")||!a)continue;const o=`${t}|${a}`;w.set(o,[...w.get(o)??[],{key:e,id:n.getAttribute("Id")??e}])}for(const[e,n]of w){if(n.length<2||!n.some(o=>p(o.key)))continue;const[t,a]=e.split("|");i("duplicate-sequence",n.map(o=>o.key),`${n.map(o=>o.id).join(" and ")} have the same Sequence (${a}) in ${t} — their order isn't defined; give one another Sequence`,n[0].id,!0)}for(const{key:e,el:n}of u)for(const t of N(n))for(const a of Array.from(t.attributes)){if(a.name!=="Library"&&!J.has(a.name))continue;const o=/^\/?WebResources\/(.+)$/i.exec(a.value.trim())?.[1];o&&i("webresource-path",e,`${t.tagName} ${t.getAttribute("Id")??""} ${a.name} is the path ${a.value} — use $webresource:${o}, the only form that makes the solution depend on the web resource`.replace(/\s+/g," "),t.getAttribute("Id")??void 0,!0)}if(l.webResources){const e=new Set;for(const{el:n}of u)for(const t of N(n))for(const a of Array.from(t.attributes)){const o=ne.exec(a.value.trim())?.[1],r=o?.toLowerCase();if(!o||!r||oe.has(r)||e.has(r))continue;const c=l.webResources[r];if(!c)continue;const y=t.getAttribute("Id")??void 0;c.exists?!c.inSolution&&!c.managed&&(e.add(r),f.push({severity:"warning",code:"webresource-not-in-solution",message:`Web resource ${o} isn't in the selected solution — the ribbon won't import into another environment without it`,elementId:y})):(e.add(r),f.push({severity:"warning",code:"webresource-missing",message:`Web resource ${o} (${t.tagName} ${a.name}) doesn't exist in this environment — ${J.has(a.name)?"the button will show no icon":"the action or rule that loads it will fail when it runs"}`,elementId:y}))}}const C=new Map,L=e=>{let n=C.get(e);return n||C.set(e,n=new Map),n};for(const[e,n]of Object.entries(l.tabScaling??{})){for(const t of n.maxSizes)L(e).set(t.id,{...t,tag:"MaxSize"});for(const t of n.scales)L(e).set(t.id,{...t,tag:"Scale"})}const F=new Map(Object.entries(l.groupTemplates??{}).map(([e,n])=>[e,ee(n)])),z=new Map(Object.entries(l.templateLayouts??{}));for(const{part:e,el:n}of u)if(e==="templates")for(const t of N(n).filter(a=>a.tagName==="GroupTemplate")){const a=A(t).filter(o=>o.tagName==="Layout").map(o=>o.getAttribute("Title")??"");z.set(t.getAttribute("Id")??"",a)}const x=[];for(const{key:e,el:n}of d){for(const r of Array.from(n.getElementsByTagName("Group"))){const c=r.getAttribute("Template");c&&F.set(r.getAttribute("Id")??"",ee(c))}const t=[],a=Y.exec(n.getAttribute("Location")??"")?.[1],o=A(n).find(r=>r.tagName==="CommandUIDefinition");if(a&&o)for(const r of A(o))t.push([a,r]);for(const r of Array.from(n.getElementsByTagName("Tab")))for(const c of A(r).filter(y=>y.tagName==="Scaling"))for(const y of A(c))t.push([r.getAttribute("Id")??"",y]);for(const[r,c]of t){if(c.tagName!=="MaxSize"&&c.tagName!=="Scale")continue;const y={id:c.getAttribute("Id")??"",tag:c.tagName,groupId:c.getAttribute("GroupId")??"",size:c.getAttribute("Size")??"",sequence:parseInt(c.getAttribute("Sequence")??"",10),key:e};L(r).set(y.id,y),x.push(y)}}for(const[e,n]of C){const t=new Map;for(const a of n.values())Number.isNaN(a.sequence)||t.set(a.sequence,[...t.get(a.sequence)??[],a]);for(const[a,o]of t){const r=[...new Set(o.flatMap(h=>h.key?[h.key]:[]))];if(o.length<2||r.length===0)continue;const c=o.find(h=>h.key&&h.tag==="MaxSize"&&h.id===`${h.groupId}.MaxSize`),y=c?`move group ${c.groupId} to another position (its MaxSize takes the group's Sequence; #66 picks a free one automatically)`:"give each step its own Sequence";i("scaling-collision",r,`Scaling of tab ${e}: ${o.map(h=>`${h.tag} ${h.id}`).join(" and ")} have the same Sequence ${a} — Unified Interface then drops every custom control of the table; ${y}`,o.find(h=>h.key)?.id)}}for(const e of x){const n=F.get(e.groupId),t=n?z.get(n):void 0;!t?.length||t.includes(e.size)||i("scaling-size",e.key??[],`${e.tag} ${e.id} has Size "${e.size}", which isn't a layout of template ${n} used by group ${e.groupId} (${t.join(", ")})`,e.id,!0)}const j=new Set(l.known?.elementIds??[]),M=new Map;for(const{key:e,el:n}of d){if(!(n.getAttribute("Location")??"").endsWith("._children"))continue;const t=A(n).find(o=>o.tagName==="CommandUIDefinition"),a=t?A(t)[0]:void 0;if(!(!a||a.tagName==="MaxSize"||a.tagName==="Scale"))for(const o of N(a)){const r=o.getAttribute("Id");if(!r||o.closest("Scaling"))continue;const c=M.get(r)??[];c.includes(e)||M.set(r,[...c,e])}}for(const[e,n]of M)n.length>1?i("duplicate-id",n,`Id ${e} is added by more than one CustomAction (${n.map(t=>t.replace(/^customActions:ca:/,"")).join(", ")})`,e):m.has(n[0])&&j.has(e)&&i("duplicate-id",n,`Id ${e} is added as a new element, but the ribbon already has an element with this id`,e);if(l.places){const{entityLogicalName:e,tabByCollection:n}=l.places,t=new Set(["Mscrm.Tabs",`Mscrm.SubGrid.${e}.ContextualTabs`]);for(const{key:a,el:o}of d){const r=o.getAttribute("Location")??"",c=/^(.+)\._children$/.exec(r)?.[1];if(!c||Y.test(r)||!p(a))continue;const y=A(o).find(k=>k.tagName==="CommandUIDefinition"),h=y?A(y)[0]:void 0,P=h?.getAttribute("Id")??"";if(!h||!P||!(Pe.has(h.tagName)||Q.has(h.tagName)))continue;const B=c.split("{!EntityLogicalName}").join(e),U=n[B];if(U!==void 0){le(U)&&i("orphan-location",a,`${h.tagName} ${P} is added to ${c}, on the tab ${U}: Unified Interface doesn't show that tab and the ribbon doesn't return what is added there, so it won't show anywhere — add it to the table's main tab instead`,P,!0);continue}const G=k=>k.replace(/\.(Controls|Groups)$/,"");t.has(B)||[c,B,G(c),G(B)].some(k=>M.has(k))||i("orphan-location",a,`${h.tagName} ${P} is added at ${r}, but this table's ribbon has no ${c} — it won't show anywhere (check the Location, or move it to an existing group)`,P,!0)}}const _=l.publisherPrefix?.trim().toLowerCase();if(_&&m.size>0){const e=new Set([...j,...l.known?.commandIds??[],...l.known?.enableRuleIds??[],...l.known?.displayRuleIds??[]]),n=o=>{const r=o.split(".");for(let c=r.length;c>0;c--)if(e.has(r.slice(0,c).join(".")))return!0;return!1},t=o=>{const r=o.toLowerCase();return r.startsWith(`${_}.`)||r.startsWith(`${_}_`)},a=new Set;for(const{part:o,key:r,el:c}of u)if(!(!m.has(r)||o==="templates"||o==="tabDisplayRules"))for(const y of N(c)){if(y!==c&&y.closest("Actions, EnableRules, DisplayRules, EnableRule, DisplayRule"))continue;const h=y.getAttribute("Id")??y.getAttribute("HideActionId");!h||a.has(h)||t(h)||n(h)||(a.add(h),f.push({severity:"warning",code:"id-prefix",message:`${y.tagName} id ${h} doesn't start with the publisher prefix "${_}." — ids without it can collide with other solutions`,elementId:h}))}}return f}export{_e as a,qe as v,Be as w};
3
+ `)}),b.querySelectorAll("Group").forEach(i=>{const d=[];i.querySelectorAll(":scope > Controls > Button, :scope > Controls > FlyoutAnchor, :scope > Controls > SplitButton").forEach(R=>{const $=parseInt(R.getAttribute("Sequence")??"0",10);if(d.includes($)){const S=i.getAttribute("Id")??"?";u.push({message:`Two elements share Sequence "${$}" in group "${S}"`,elementId:S,lineHint:E(s,`Sequence="${$}"`)})}d.push($)})}),u.push(...Ee(b,s)),u}const X=new Set(["BoolParameter","CrmParameter","DecimalParameter","IntParameter","StringParameter"]);function A(s){return Array.from(s.children)}function te(s,l){return l==="enable"?ue.has(s):me.has(s)}function Ee(s,l){const g=[],u=(m,i,d)=>g.push({message:m,elementId:d,lineHint:E(l,i)}),f=(m,i,d)=>g.push({message:m,elementId:d,lineHint:E(l,i),severity:"warning"}),b=s.querySelector("RibbonDiffXml > RuleDefinitions"),p=[{tag:"EnableRule",label:"Enable",container:"enable"},{tag:"DisplayRule",label:"Display",container:"display"}];for(const{tag:m,label:i,container:d}of p)b?.querySelectorAll(`:scope > ${m}s > ${m}`).forEach(R=>{const $=R.getAttribute("Id")??"",S=A(R);S.length===0&&u(`${i} rule "${$}" has no steps — the schema requires at least one`,`Id="${$}"`,$);const D=I=>{te(I.tagName,d)&&f(`${i} rule "${$}" contains ${I.tagName}, which RibbonTypes.xsd only allows in ${d==="enable"?"display":"enable"} rules`,`<${I.tagName}`,$)};for(const I of S){if(I.tagName!=="OrRule"){D(I);continue}const T=A(I);T.filter(w=>w.tagName==="Or").length<2&&u(`OrRule in ${i.toLowerCase()} rule "${$}" needs at least 2 <Or> children (found ${T.filter(w=>w.tagName==="Or").length})`,"<OrRule",$);for(const w of T){const C=A(w);C.length===0&&u(`Empty <Or> in rule "${$}"`,"<Or",$);for(const L of C)L.tagName==="OrRule"?u(`Rule "${$}": an <Or> cannot contain another OrRule`,"<OrRule",$):D(L)}}});return b||s.querySelectorAll("OrRule").forEach(m=>{const i=m.querySelectorAll(":scope > Or").length;i<2&&u(`OrRule requires at least 2 <Or> children (found ${i})`,"<OrRule")}),s.querySelectorAll("JavaScriptFunction, CustomRule").forEach(m=>{for(const i of A(m)){if(!X.has(i.tagName))continue;i.hasAttribute("Name")&&u(`${i.tagName} inside <${m.tagName}> must not have a Name attribute (only <Url> parameters are named)`,`<${i.tagName} Name=`);const d=i.getAttribute("Value")??"";i.tagName==="CrmParameter"&&!de.has(d)&&u(`CrmParameter Value "${d}" is not a valid CrmParameterValue`,`Value="${d}"`)}}),s.querySelectorAll("Url").forEach(m=>{for(const i of A(m)){if(!X.has(i.tagName))continue;i.getAttribute("Name")||u(`${i.tagName} inside <Url> requires a Name (the query-string key)`,`<${i.tagName}`);const d=i.getAttribute("Value")??"";i.tagName==="CrmParameter"&&!fe(d)&&u(`CrmParameter Value "${d}" is not allowed in a <Url> action (CrmNamedParameterValue)`,`Value="${d}"`)}}),s.querySelector("RibbonDiffXml > Scalings")&&u('<Scalings> is not allowed in RibbonDiffXml — scaling changes are CustomActions with Location="{tabId}.Scaling._children"',"<Scalings"),s.querySelectorAll("CustomAction > CommandUIDefinition > Tab").forEach(m=>{const i=m.getAttribute("Id")??"",d=A(m).map(S=>S.tagName),R=d.indexOf("Scaling"),$=d.indexOf("Groups");(R<0||$>=0&&R>$)&&u(`Tab "${i}" needs a <Scaling Id> element before <Groups>`,`Id="${i}"`,i)}),s.querySelectorAll("TabDisplayRule > DisplayRules").forEach(()=>{u("TabDisplayRule rules must be direct children — remove the <DisplayRules> wrapper","<TabDisplayRule")}),g}const Te=["LabelText","ToolTipTitle","ToolTipDescription","Alt","Title","Description"],Ce=new Set(["powerFx","customApi"]),Le={powerFx:"Power Fx",customApi:"Custom API"};function ve(s){return[...new Set(s.actions.map(l=>l.kind).filter(l=>Ce.has(l)))]}const K=/^\$LocLabels:(.+)$/,ne=/^\$webresource:([^?#]+)/i,J=new Set(["ModernImage","Image16by16","Image32by32"]),Q=new Set(["Tab","Group"]),oe=new Set(["main_system_library.js"]),Oe=new Set(["FlyoutAnchor","SplitButton"]),Pe=new Set(["Button","FlyoutAnchor","SplitButton","TextBox","ComboBox","CheckBox"]),Y=/^(.+)\.Scaling\._children$/,Z=s=>/^(Mscrm|Microsoft)\./.test(s);function ae(s){const l=[],g=[],u=new DOMParser;for(const f of Object.keys(s))for(const[b,p]of s[f]){const m=u.parseFromString(p,"application/xml");if(m.querySelector("parsererror")){g.push({severity:"error",code:"xml-parse",message:`${f} element ${b} is not well-formed XML`,elementId:b});continue}l.push({part:f,key:`${f}:${b}`,el:m.documentElement})}return{elements:l,errors:g}}function N(s){return[s,...Array.from(s.getElementsByTagName("*"))]}function se(s){return typeof s=="string"?ce(s):s}function Be(s){let l;try{l=se(s)}catch{return[]}const g=new Map;for(const{el:u}of ae(l).elements)for(const f of N(u))for(const b of Array.from(f.attributes)){const p=ne.exec(b.value.trim())?.[1],m=p?.toLowerCase();p&&m&&!oe.has(m)&&!g.has(m)&&g.set(m,p)}return[...g.values()]}const ee=s=>{const l=s.trim();return l&&!l.includes(".")?`Mscrm.Templates.${l}`:l};function qe(s,l={}){let g;try{g=se(s)}catch(e){return[{severity:"error",code:"xml-parse",message:e instanceof Error?e.message:String(e)}]}const{elements:u,errors:f}=ae(g),b=l.changedKeys?new Set(l.changedKeys):null,p=e=>!b||b.has(e),m=new Set(l.newKeys??[]),i=(e,n,t,a,o=!1)=>{const r=(Array.isArray(n)?n:[n]).some(p);f.push({severity:o||!r?"warning":"error",code:e,message:r?t:`${t} (already in the published customizations)`,elementId:a})},d=u.filter(e=>e.part==="customActions"),R=u.filter(e=>e.part==="commandDefinitions");for(const{part:e,key:n,el:t}of u)if(!(e!=="commandDefinitions"&&e!=="enableRules"&&e!=="displayRules"))for(const a of we(t))i("schema",n,a,t.getAttribute("Id")??void 0);const $=new Map((l.commands??[]).map(e=>[e.id,e]));for(const{key:e,el:n}of R){const t=n.getAttribute("Id")??"",a=$.get(t);if(!a||!p(e))continue;const o=ve(a);o.length!==0&&i("dropped-action",e,`Command ${t} has a ${o.map(r=>Le[r]??r).join(" / ")} action — classic ribbon commands can't run it, so it would be dropped; remove the action`,t)}const S=new Set;for(const{el:e}of d)if(e.tagName==="CustomAction")for(const n of Array.from(e.getElementsByTagName("*")))n.getAttribute("Command")===v&&S.add(n.getAttribute("Id")??"");for(const{key:e,el:n}of d){if(n.tagName!=="HideCustomAction")continue;const t=n.getAttribute("Location")??"";!S.has(t)&&!ie({id:t,commandId:v})||i("open-record-hidden",e,`${t} is hidden, but it carries the record open override (${v}) — Unified Interface may then open records as usual or fail to open them; unhide it, or turn the override off`,t,!0)}for(const{key:e,el:n}of R){if(n.getAttribute("Id")!==v)continue;const t=A(n).filter(o=>o.tagName==="DisplayRules").flatMap(o=>A(o).map(r=>r.getAttribute("Id")??r.tagName));if(t.length===0)continue;const a=t.includes("Mscrm.HideOnModern")?Ne.filter(o=>t.includes(o)):[];i("open-record-hidden",e,`${v} has display rules (${t.join(", ")})${a.length>0?` — ${a.join(" + ")} hide its button`:""}: where they hide the "Open record" button, the record open override may stop working; the button must stay shown`,v,!0)}for(const{key:e,el:n}of d)for(const t of Array.from(n.getElementsByTagName("*"))){if(!Oe.has(t.tagName)||A(t).some(o=>o.tagName==="Menu"))continue;const a=t.getAttribute("Id")??"";if(re(t.getAttribute("PopulateDynamically"))){t.getAttribute("PopulateQueryCommand")?.trim()||i("menu-missing",e,`${t.tagName} ${a} is populated dynamically but has no PopulateQueryCommand — its drop-down may stay empty`,a,!0);continue}i("menu-missing",e,`${t.tagName} ${a} has no <Menu> — it would publish as an empty drop-down`,a)}const D=new Set(l.menuControlsIds??[]);for(const{key:e,el:n}of d){const t=n.getAttribute("Location")??"",a=t.endsWith("._children")&&D.has(t.slice(0,-10));for(const o of Array.from(n.getElementsByTagName("*"))){const r=a||!!o.parentElement?.closest("Menu");for(const c of Te){const y=o.getAttribute(c);if(!y?.startsWith("$LocLabels:"))continue;const h=y.slice(11);h.length<=V||i("label-id-length",e,`${o.tagName} ${o.getAttribute("Id")??""} uses label ${h} (${h.length} characters)`+(r?`: a menu item's label id may have at most ${V} characters, or the publish fails after the import — give the control a shorter id`:`: label ids over ${V} characters fail inside menus; consider a shorter control id`),o.getAttribute("Id")??void 0,!r)}}}if(l.known?.commandIds){const e=new Set([...g.commandDefinitions.keys(),...l.known.commandIds]);for(const{key:n,el:t}of d)for(const a of Array.from(t.getElementsByTagName("*")))if(!Q.has(a.tagName))for(const o of["Command","PopulateQueryCommand"]){const r=a.getAttribute(o);if(!r||e.has(r))continue;const c=a.getAttribute("Id")??"";i("undefined-command",n,`${a.tagName} ${c} uses ${o==="Command"?"command":"PopulateQueryCommand"} ${r}, which is defined neither in the customizations nor in the loaded ribbon`,c,Z(r))}}const I={EnableRule:l.known?.enableRuleIds?new Set([...g.enableRules.keys(),...l.known.enableRuleIds]):null,DisplayRule:l.known?.displayRuleIds?new Set([...g.displayRules.keys(),...l.known.displayRuleIds]):null};for(const{key:e,el:n}of R){const t=n.getAttribute("Id")??"",a=A(n).filter(o=>o.tagName==="EnableRules"||o.tagName==="DisplayRules").flatMap(A);for(const o of a){const r=I[o.tagName],c=o.getAttribute("Id");!r||!c||r.has(c)||i("undefined-rule",e,`Command ${t} uses ${o.tagName==="EnableRule"?"enable":"display"} rule ${c}, which is defined neither in the customizations nor in the loaded ribbon`,t,Z(c))}}for(const{part:e,key:n,el:t}of u){if(e!=="enableRules"&&e!=="displayRules")continue;const a=e==="enableRules"?"enable":"display",o=t.getAttribute("Id")??"",r=A(t).flatMap(c=>c.tagName==="OrRule"?A(c).filter(y=>y.tagName==="Or").flatMap(A):[c]);for(const c of r)te(c.tagName,a)&&i("rule-placement",n,`${a==="enable"?"Enable":"Display"} rule ${o} contains ${c.tagName}, which the ribbon schema only allows in ${a==="enable"?"display":"enable"} rules`,o,!0)}const T=new Set;for(const e of Object.values(l.loadedAttributes??{}))for(const n of Object.values(e))K.test(n)&&T.add(n);for(const{key:e,el:n}of u)if(n.tagName!=="LocLabel")for(const t of N(n))for(const a of Array.from(t.attributes)){const o=K.exec(a.value)?.[1];if(!o||g.locLabels.has(o))continue;const r=t.getAttribute("Id")??void 0;r&&l.loadedAttributes?.[r]?.[a.name]===a.value||T.has(a.value)||i("loclabel-missing",e,`${[t.tagName,r,a.name].filter(Boolean).join(" ")} references $LocLabels:${o}, which has no <LocLabel> in these customizations — the text won't resolve unless another solution defines the label`,r,!0)}const w=new Map;for(const{key:e,el:n}of d){const t=n.getAttribute("Location")??"",a=n.getAttribute("Sequence");if(n.tagName!=="CustomAction"||!t.endsWith("._children")||!a)continue;const o=`${t}|${a}`;w.set(o,[...w.get(o)??[],{key:e,id:n.getAttribute("Id")??e}])}for(const[e,n]of w){if(n.length<2||!n.some(o=>p(o.key)))continue;const[t,a]=e.split("|");i("duplicate-sequence",n.map(o=>o.key),`${n.map(o=>o.id).join(" and ")} have the same Sequence (${a}) in ${t} — their order isn't defined; give one another Sequence`,n[0].id,!0)}for(const{key:e,el:n}of u)for(const t of N(n))for(const a of Array.from(t.attributes)){if(a.name!=="Library"&&!J.has(a.name))continue;const o=/^\/?WebResources\/(.+)$/i.exec(a.value.trim())?.[1];o&&i("webresource-path",e,`${t.tagName} ${t.getAttribute("Id")??""} ${a.name} is the path ${a.value} — use $webresource:${o}, the only form that makes the solution depend on the web resource`.replace(/\s+/g," "),t.getAttribute("Id")??void 0,!0)}if(l.webResources){const e=new Set;for(const{el:n}of u)for(const t of N(n))for(const a of Array.from(t.attributes)){const o=ne.exec(a.value.trim())?.[1],r=o?.toLowerCase();if(!o||!r||oe.has(r)||e.has(r))continue;const c=l.webResources[r];if(!c)continue;const y=t.getAttribute("Id")??void 0;c.exists?!c.inSolution&&!c.managed&&(e.add(r),f.push({severity:"warning",code:"webresource-not-in-solution",message:`Web resource ${o} isn't in the selected solution — the ribbon won't import into another environment without it`,elementId:y})):(e.add(r),f.push({severity:"warning",code:"webresource-missing",message:`Web resource ${o} (${t.tagName} ${a.name}) doesn't exist in this environment — ${J.has(a.name)?"the button will show no icon":"the action or rule that loads it will fail when it runs"}`,elementId:y}))}}const C=new Map,L=e=>{let n=C.get(e);return n||C.set(e,n=new Map),n};for(const[e,n]of Object.entries(l.tabScaling??{})){for(const t of n.maxSizes)L(e).set(t.id,{...t,tag:"MaxSize"});for(const t of n.scales)L(e).set(t.id,{...t,tag:"Scale"})}const F=new Map(Object.entries(l.groupTemplates??{}).map(([e,n])=>[e,ee(n)])),z=new Map(Object.entries(l.templateLayouts??{}));for(const{part:e,el:n}of u)if(e==="templates")for(const t of N(n).filter(a=>a.tagName==="GroupTemplate")){const a=A(t).filter(o=>o.tagName==="Layout").map(o=>o.getAttribute("Title")??"");z.set(t.getAttribute("Id")??"",a)}const j=[];for(const{key:e,el:n}of d){for(const r of Array.from(n.getElementsByTagName("Group"))){const c=r.getAttribute("Template");c&&F.set(r.getAttribute("Id")??"",ee(c))}const t=[],a=Y.exec(n.getAttribute("Location")??"")?.[1],o=A(n).find(r=>r.tagName==="CommandUIDefinition");if(a&&o)for(const r of A(o))t.push([a,r]);for(const r of Array.from(n.getElementsByTagName("Tab")))for(const c of A(r).filter(y=>y.tagName==="Scaling"))for(const y of A(c))t.push([r.getAttribute("Id")??"",y]);for(const[r,c]of t){if(c.tagName!=="MaxSize"&&c.tagName!=="Scale")continue;const y={id:c.getAttribute("Id")??"",tag:c.tagName,groupId:c.getAttribute("GroupId")??"",size:c.getAttribute("Size")??"",sequence:parseInt(c.getAttribute("Sequence")??"",10),key:e};L(r).set(y.id,y),j.push(y)}}for(const[e,n]of C){const t=new Map;for(const a of n.values())Number.isNaN(a.sequence)||t.set(a.sequence,[...t.get(a.sequence)??[],a]);for(const[a,o]of t){const r=[...new Set(o.flatMap(h=>h.key?[h.key]:[]))];if(o.length<2||r.length===0)continue;const c=o.find(h=>h.key&&h.tag==="MaxSize"&&h.id===`${h.groupId}.MaxSize`),y=c?`move group ${c.groupId} to another position (its MaxSize takes the group's Sequence; #66 picks a free one automatically)`:"give each step its own Sequence";i("scaling-collision",r,`Scaling of tab ${e}: ${o.map(h=>`${h.tag} ${h.id}`).join(" and ")} have the same Sequence ${a} — Unified Interface then drops every custom control of the table; ${y}`,o.find(h=>h.key)?.id)}}for(const e of j){const n=F.get(e.groupId),t=n?z.get(n):void 0;!t?.length||t.includes(e.size)||i("scaling-size",e.key??[],`${e.tag} ${e.id} has Size "${e.size}", which isn't a layout of template ${n} used by group ${e.groupId} (${t.join(", ")})`,e.id,!0)}const x=new Set(l.known?.elementIds??[]),M=new Map;for(const{key:e,el:n}of d){if(!(n.getAttribute("Location")??"").endsWith("._children"))continue;const t=A(n).find(o=>o.tagName==="CommandUIDefinition"),a=t?A(t)[0]:void 0;if(!(!a||a.tagName==="MaxSize"||a.tagName==="Scale"))for(const o of N(a)){const r=o.getAttribute("Id");if(!r||o.closest("Scaling"))continue;const c=M.get(r)??[];c.includes(e)||M.set(r,[...c,e])}}for(const[e,n]of M)n.length>1?i("duplicate-id",n,`Id ${e} is added by more than one CustomAction (${n.map(t=>t.replace(/^customActions:ca:/,"")).join(", ")})`,e):m.has(n[0])&&x.has(e)&&i("duplicate-id",n,`Id ${e} is added as a new element, but the ribbon already has an element with this id`,e);if(l.places){const{entityLogicalName:e,tabByCollection:n}=l.places,t=new Set(["Mscrm.Tabs",`Mscrm.SubGrid.${e}.ContextualTabs`]);for(const{key:a,el:o}of d){const r=o.getAttribute("Location")??"",c=/^(.+)\._children$/.exec(r)?.[1];if(!c||Y.test(r)||!p(a))continue;const y=A(o).find(k=>k.tagName==="CommandUIDefinition"),h=y?A(y)[0]:void 0,P=h?.getAttribute("Id")??"";if(!h||!P||!(Pe.has(h.tagName)||Q.has(h.tagName)))continue;const B=c.split("{!EntityLogicalName}").join(e),U=n[B];if(U!==void 0){le(U)&&i("orphan-location",a,`${h.tagName} ${P} is added to ${c}, on the tab ${U}: Unified Interface doesn't show that tab and the ribbon doesn't return what is added there, so it won't show anywhere — add it to the table's main tab instead`,P,!0);continue}const G=k=>k.replace(/\.(Controls|Groups)$/,"");t.has(B)||[c,B,G(c),G(B)].some(k=>M.has(k))||i("orphan-location",a,`${h.tagName} ${P} is added at ${r}, but this table's ribbon has no ${c} — it won't show anywhere (check the Location, or move it to an existing group)`,P,!0)}}const _=l.publisherPrefix?.trim().toLowerCase();if(_&&m.size>0){const e=new Set([...x,...l.known?.commandIds??[],...l.known?.enableRuleIds??[],...l.known?.displayRuleIds??[]]),n=o=>{const r=o.split(".");for(let c=r.length;c>0;c--)if(e.has(r.slice(0,c).join(".")))return!0;return!1},t=o=>{const r=o.toLowerCase();return r.startsWith(`${_}.`)||r.startsWith(`${_}_`)},a=new Set;for(const{part:o,key:r,el:c}of u)if(!(!m.has(r)||o==="templates"||o==="tabDisplayRules"))for(const y of N(c)){if(y!==c&&y.closest("Actions, EnableRules, DisplayRules, EnableRule, DisplayRule"))continue;const h=y.getAttribute("Id")??y.getAttribute("HideActionId");!h||a.has(h)||t(h)||n(h)||(a.add(h),f.push({severity:"warning",code:"id-prefix",message:`${y.tagName} id ${h} doesn't start with the publisher prefix "${_}." — ids without it can collide with other solutions`,elementId:h}))}}return f}export{_e as a,qe as v,Be as w};
@@ -1,15 +1,12 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="4 8 56 48" width="56" height="48">
2
- <!-- Variant L — "Insider build" / CBS
3
- Same K chassis + small gold triangle filling the top-right vertex of
4
- the hex (Microsoft Insiders gold, #FFB900). Shipped for prerelease
5
- versions (e.g. 0.6.0-beta.1); see the tool-icon plugin in vite.config.ts. -->
2
+ <!-- Variant K — "Clean hex split" / CBS
3
+ Same chassis as the sibling studios (FXS, DRS); tool glyph is a
4
+ command bar: a rounded bar holding three command buttons, with the
5
+ middle one selected. -->
6
6
 
7
7
  <path d="M 18 8 L 46 8 L 60 32 L 46 56 L 18 56 L 4 32 Z" fill="#0E5A9C"/>
8
8
  <polygon points="46,8 60,32 46,56 18,56" fill="#2B8FD9"/>
9
9
 
10
- <!-- Insider stamp — gold triangle in top-right vertex -->
11
- <polygon points="46,8 40,8 49,15" fill="#FFB900"/>
12
-
13
10
  <!-- Tool glyph — command bar with three buttons, in white -->
14
11
  <rect x="14" y="23" width="36" height="18" rx="3.5" stroke="#fff" stroke-width="2.5" fill="none"/>
15
12
  <rect x="19" y="28.5" width="7" height="7" rx="1.5" fill="#fff"/>
package/dist/index.html CHANGED
@@ -4,12 +4,10 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Command Bar Studio</title>
7
- <script type="module" crossorigin src="./assets/index-6so8O90C.js"></script>
8
- <link rel="modulepreload" crossorigin href="./assets/monaco-BIO15LCS.js">
9
- <link rel="modulepreload" crossorigin href="./assets/fluent-icons-CQEhzzaC.js">
10
- <link rel="modulepreload" crossorigin href="./assets/fluent-ui-BEjALNLO.js">
11
- <link rel="modulepreload" crossorigin href="./assets/dnd-C1w9VFfC.js">
12
- <link rel="stylesheet" crossorigin href="./assets/monaco-DdLsZAcA.css">
7
+ <script type="module" crossorigin src="./assets/index-D7TexD30.js"></script>
8
+ <link rel="modulepreload" crossorigin href="./assets/fluent-ui-CQyNN9H3.js">
9
+ <link rel="modulepreload" crossorigin href="./assets/preload-helper-PPVm8Dsz.js">
10
+ <link rel="modulepreload" crossorigin href="./assets/dnd-iy5K5XAJ.js">
13
11
  <link rel="stylesheet" crossorigin href="./assets/index-D5GCH8nj.css">
14
12
  </head>
15
13
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohsinonxrm/pptb-commandbar-studio",
3
- "version": "0.9.0-beta.1",
3
+ "version": "0.9.0",
4
4
  "displayName": "Command Bar Studio",
5
5
  "description": "Visual designer for Dataverse classic ribbon / command bar customizations — the spiritual successor to Ribbon Workbench, built for Power Platform ToolBox",
6
6
  "author": "Mohsin On xRM",
@@ -67,6 +67,7 @@
67
67
  "lint": "eslint . --max-warnings 0",
68
68
  "test": "vitest run",
69
69
  "test:watch": "vitest",
70
+ "test:coverage": "vitest run --coverage",
70
71
  "validate": "pptb-validate",
71
72
  "format": "prettier --write .",
72
73
  "format:check": "prettier --check .",
@@ -93,6 +94,7 @@
93
94
  "@types/react": "^18.3.21",
94
95
  "@types/react-dom": "^18.3.5",
95
96
  "@vitejs/plugin-react": "^5.2.0",
97
+ "@vitest/coverage-v8": "^5.0.3",
96
98
  "eslint": "^9.25.0",
97
99
  "eslint-plugin-jsx-a11y": "^6.10.2",
98
100
  "eslint-plugin-react-hooks": "^5.2.0",
@@ -1,36 +0,0 @@
1
- import{L as n,K as Vn,aa as us,V as hs,cm as ms,ac as ps,a8 as bs,a7 as gs,ab as fs,a4 as ys,ad as xs}from"./fluent-icons-CQEhzzaC.js";import{p as ve,e as ws,g as Cs,m as _e,d as js,f as vs,h as Rs,j as Ss,n as $s,k as Qe,o as Is,l as Ns,q as ks,r as Ps,s as He,t as Ts,v as As,w as Es,x as Sn,y as Ds,z as Ls,A as Ke,B as zs,C as Ms,D as z,E as Bn,F as en,G as Pe,H as Os,J as Us,K as $n,L as Xs,M as Ge,N as Vs,O as In,P as Bs,Q as qn,R as F,S as Fn,T as qs,U as Je,V as Fs,b as Nn,a as V,W as Ws,X as Re,Y as _s,Z as Ks,_ as Gs,$ as Hs,a0 as kn}from"./index-6so8O90C.js";import{a as $,R as re}from"./monaco-BIO15LCS.js";import{M as Js}from"./MonacoEditor-BMKRZv-g.js";import{w as Ys,v as Wn}from"./xmlValidator-PbODaIQV.js";import{L as se,N as te,Q as Ne,b as D,B as Ye,F as ke,X as _n,t as I,ag as Pn,h as ce,R as Zs,am as Qs,an as Se,ao as $e,ap as Ie,b1 as et,c as Tn,b2 as nt,a7 as st,av as tt,af as it,aj as ot}from"./fluent-ui-BEjALNLO.js";import"./dnd-C1w9VFfC.js";import"./ruleKinds-BKTUiZ1-.js";import"./crmParameters-rgfZhhzN.js";let An=0;async function nn(e){const s=typeof window<"u"?window.toolboxAPI:void 0;An++===0&&await En(()=>s?.preventClose?.());try{return await e()}finally{--An===0&&await En(()=>s?.releasePreventClose?.())}}const at=2e3;async function En(e){let s;try{await Promise.race([e(),new Promise(i=>s=setTimeout(i,at))])}catch{}finally{clearTimeout(s)}}function pe(e,s){const i=e.match(new RegExp(`\\s${s}="([^"]*)"`));return i?i[1]:null}function Dn(e,s,i){const o=e.indexOf(i,s);return e.slice(s,o===-1?void 0:o).match(/<result\s[^>]*>/g)??[]}function Ln(e){const s=e.find(i=>pe(i,"result")!=="success");if(s){const i=pe(s,"errorcode")??"",o=pe(s,"errortext")??"unknown error";return{ok:!1,message:`Dataverse rejected the ribbon (${i}): ${o}`}}return null}function lt(e,s){if(!e)return{ok:!1,message:"The import job returned no result data, so the ribbon import could not be verified."};if(s.kind==="application"){const a=e.search(/<ribbon\s[^>]*processed="true"/);return a===-1?{ok:!1,message:"Import completed, but Dataverse did not process the application ribbon."}:Ln(Dn(e,a,"</ribbon>"))??{ok:!0,message:"Application ribbon imported."}}const i=new Set(s.names.filter(Boolean).map(a=>a.toLowerCase())),o=/<entityRibbon\s[^>]*>/g;let l;for(;l=o.exec(e);){const a=(pe(l[0],"id")??"").toLowerCase();if(i.has(a))return pe(l[0],"processed")!=="true"?{ok:!1,message:`Dataverse did not process the ribbon for ${a}.`}:Ln(Dn(e,l.index,"</entityRibbon>"))??{ok:!0,message:`Ribbon for ${a} imported.`}}return{ok:!1,message:`Import completed, but Dataverse did not apply a ribbon for ${s.names.join(" / ")} (no entityRibbon result in the import job). Nothing was changed.`}}const G=window.dataverseAPI;async function rt(e,s,i){return await i("The import"),G.execute({operationName:"ImportSolution",operationType:"action",parameters:{CustomizationFile:e,ImportJobId:s,OverwriteUnmanagedCustomizations:!0,PublishWorkflows:!1}})}async function ct(e,s){await s("Publishing");const i=e.map(o=>`<entity>${z(o)}</entity>`).join("");return G.execute({operationName:"PublishXml",operationType:"action",parameters:{ParameterXml:`<importexportxml><entities>${i}</entities></importexportxml>`}})}function zn(e){const s=e.data?.progress;return!!(typeof s=="object"&&s!==null&&s.completed===!0||typeof e.progress=="number"&&e.progress>=100||typeof s=="number"&&s>=100||e.completedon||e.data?.completedon||e.statuscode===30)}function dt(e){const s=e.titles.map(i=>`<Title languagecode="${i.languageCode}" description="${z(i.description)}"/>`).join("");return`<LocLabel Id="${z(e.id)}"><Titles>${s}</Titles></LocLabel>`}async function Kn(e){const s=e.entity?.logicalName??"{!EntityLogicalName}",i={deletedContainerIds:e.plan.deletedContainerIds??[],movedButtons:e.plan.movedButtons??[],editedLocLabelIds:e.plan.editedLocLabelIds??[],editedTabIds:e.plan.editedTabIds??[],resequencedTabs:e.plan.resequencedTabs??[],resequencedGroups:e.plan.resequencedGroups??[]},o=e.locLabels.filter(r=>i.editedLocLabelIds.includes(r.id)),l=e.languageCode??1033;for(const r of e.plan.renamedLabels??[]){const h=o.find(S=>S.id===r.id)??e.locLabels.find(S=>S.id===r.id),j=[{languageCode:l,description:r.text},...(h?.titles??[]).filter(S=>S.languageCode!==l)],R=o.findIndex(S=>S.id===r.id);R>=0?o[R]={id:r.id,titles:j}:o.push({id:r.id,titles:j})}let a=o.length?ve(`<RibbonDiffXml><LocLabels>${o.map(dt).join("")}</LocLabels></RibbonDiffXml>`):ws();for(const r of e.locations){const h=Cs({current:r.current,baseline:r.baseline,commands:e.commands,enableRules:e.enableRules,displayRules:e.displayRules,locLabels:e.locLabels,entityLogicalName:s,location:r.current.location,languageCode:e.languageCode});a=_e(a,ve(h))}const c=[],u=[];for(const r of e.locations)for(const h of r.current.tabs){if(!i.editedTabIds.includes(h.id))continue;if(h.tabDisplayRules.length>0){const R=js(h,e.entity===null);R&&u.push(R)}const j=new Set(h.tabDisplayRules.map(R=>R.tabCommand));for(const R of r.baseline.tabs.find(S=>S.id===h.id)?.tabDisplayRules??[])j.has(R.tabCommand)||c.push(R.tabCommand)}u.length>0&&(a=_e(a,ve(`<RibbonDiffXml><RuleDefinitions><TabDisplayRules>${u.join("")}</TabDisplayRules></RuleDefinitions></RibbonDiffXml>`)));const y=[...e.commands.filter(r=>e.plan.editedCommandIds.includes(r.id)).map(vs)],T={enable:e.enableRules.filter(r=>e.plan.editedEnableRuleIds.includes(r.id)).map(Ss),display:e.displayRules.filter(r=>e.plan.editedDisplayRuleIds.includes(r.id)).map(Rs)};(y.length||T.enable.length||T.display.length)&&(a=_e(a,ve(`<RibbonDiffXml><CommandDefinitions>${y.join("")}</CommandDefinitions><RuleDefinitions><DisplayRules>${T.display.join("")}</DisplayRules><EnableRules>${T.enable.join("")}</EnableRules></RuleDefinitions></RibbonDiffXml>`)));const P=(r,h)=>{for(const j of Array.from(r.keys()))h.includes(j)||r.delete(j)},N=e.locations.flatMap(r=>r.current.tabs.filter(h=>!r.baseline.tabs.some(j=>j.id===h.id)).map($s));P(a.commandDefinitions,[...e.plan.editedCommandIds,...N]),P(a.enableRules,e.plan.editedEnableRuleIds),P(a.displayRules,e.plan.editedDisplayRuleIds);const m=await Qe(e.entity?.logicalName??null),v=Is(m),b=e.plan.deletedButtonIds.filter(r=>!v.has(r));if(b.length>0)throw new Error(`Can't delete ${b.join(", ")}: not defined in this table's unmanaged customizations (it comes from a managed solution or the platform). Undo the delete and hide the button instead.`);const x=Ns(m),g=i.deletedContainerIds.filter(r=>!x.has(r));if(g.length>0)throw new Error(`Can't delete ${g.join(", ")}: not added by this table's unmanaged customizations (it comes from a managed solution or the platform). Undo the delete.`);const p=i.movedButtons.filter(r=>!v.has(r.id)).map(r=>r.id);if(p.length>0)throw new Error(`Can't move ${p.join(", ")}: not defined in this table's unmanaged customizations. Undo the move.`);const q=ks(m),H=(e.plan.uncustomisedCommandIds??[]).filter(r=>m.commandDefinitions.has(r)&&!Ps(r,q));if(H.length>0)throw new Error(`Can't uncustomise ${H.join(", ")}: it is your own command (your customizations' buttons use it and no other solution defines it), so removing it would leave those buttons without a command. Undo the uncustomise.`);const J=new Set;for(const r of e.locations)for(const h of r.current.tabs)for(const j of h.groups)for(const R of He(j))for(const S of Ts(R))J.add(S);const X=e.plan.uncustomisedCommandIds??[],B=new Set,Y=new Set;for(const r of e.commands)if(!(!J.has(r.id)||X.includes(r.id))){r.enableRules.forEach(h=>B.add(h)),r.displayRules.forEach(h=>Y.add(h));for(const h of r.rawRuleRefs??[]){const j=/^\s*<(EnableRule|DisplayRule)\b[^>]*?\sId="([^"]+)"/.exec(h.xml);j&&(j[1]==="EnableRule"?B:Y).add(j[2])}}let C=As(m,a,{retainedCommandIds:J,editedCommandIds:e.plan.editedCommandIds,editedEnableRuleIds:e.plan.editedEnableRuleIds,editedDisplayRuleIds:e.plan.editedDisplayRuleIds,deletedControlIds:e.plan.deletedButtonIds,unhiddenControlIds:e.plan.unhiddenButtonIds,deletedContainerIds:i.deletedContainerIds,movedControls:i.movedButtons,resequencedContainers:[...i.resequencedTabs,...i.resequencedGroups],removedTabCommands:c,uncustomisedCommandIds:X,retainedEnableRuleIds:B,retainedDisplayRuleIds:Y});for(const r of e.plan.renamedLabels??[])r.newLabel&&(C=Es(C,r.containerId,`$LocLabels:${r.id}`));const d=new Set([...Sn(m),...Sn(C)].map(r=>r.id)),k={};for(const r of e.locations)for(const[h,j]of Object.entries(r.baseline.scalingByTab??{}))k[h]={maxSizes:j.maxSizes.filter(R=>!d.has(R.id)).map(R=>R.sequence),scales:j.scales.filter(R=>!d.has(R.id)).map(R=>R.sequence)};const A=Ds(C,k);if(A.problems.length>0)throw new Error(`Not published: ${A.problems.join("; ")}.`);return C=A.parts,{scalingChanges:A.changes,xml:zs(C),parts:C,elementCount:Ke(C),preservedCount:Ke(m),changedCount:Ke(a),changedKeys:Ls(m,C),newKeys:Object.keys(C).flatMap(r=>Array.from(C[r].keys()).filter(h=>!m[r].has(h)).map(h=>`${r}:${h}`)),layerDefinitionIds:{commandIds:Array.from(m.commandDefinitions.keys()),enableRuleIds:Array.from(m.enableRules.keys()),displayRuleIds:Array.from(m.displayRules.keys())},layer:m}}function Gn(e,s){const i=[],o={},l={},a={},c={},u=new Set,y=new Set,T=new Set;for(const{current:m,baseline:v}of e.locations)for(const b of[v,m])for(const x of b.tabs)for(const g of x.groups)for(const p of He(g))for(const q of p.menu?.sections??[])T.add(q.controlsId);for(const{current:m,baseline:v}of e.locations){Object.assign(a,v.templateLayouts);for(const b of v.tabs){i.push(b.id),b.label&&(c[b.id]={Title:b.label});for(const x of b.groups){u.add(x.id),i.push(x.id),x.label&&(c[x.id]={Title:x.label,Label:x.label});for(const g of He(x))i.push(g.id),g.source&&(c[g.id]=g.source.attributes)}}for(const b of m.tabs)for(const x of b.groups)y.add(x.id);for(const b of[v,m])for(const x of b.tabs)for(const g of x.groups)g.template&&(l[g.id]=g.template)}const P=m=>u.has(m.groupId)&&!y.has(m.groupId);for(const{baseline:m}of e.locations)for(const[v,b]of Object.entries(m.scalingByTab??{}))o[v]={...b,maxSizes:b.maxSizes.filter(x=>!P(x)),scales:b.scales.filter(x=>!P(x))};const N=(m,v)=>{if(!m)return;const b=new Set(v??[]);return m.map(x=>x.id).filter(x=>!b.has(x))};return{changedKeys:s.changedKeys,newKeys:s.newKeys,commands:e.commands,known:{commandIds:N(e.baselineCommands,s.layerDefinitionIds?.commandIds),enableRuleIds:N(e.baselineEnableRules,s.layerDefinitionIds?.enableRuleIds),displayRuleIds:N(e.baselineDisplayRules,s.layerDefinitionIds?.displayRuleIds),elementIds:i},loadedAttributes:c,publisherPrefix:e.publisherPrefix,tabScaling:o,groupTemplates:l,templateLayouts:a,menuControlsIds:T,...e.entity?{places:{entityLogicalName:e.entity.logicalName,tabByCollection:Object.fromEntries(Ms(e.locations.map(m=>m.baseline),e.entity.logicalName))}}:{}}}function ut(e,s){return new Promise((i,o)=>{const l=setTimeout(()=>o(new Error(`it didn't finish within ${Math.round(s/1e3)} s`)),s);e.then(a=>{clearTimeout(l),i(a)},a=>{clearTimeout(l),o(a)})})}async function Mn(e,s={}){const i=await Kn(e),o=Gn(e,i),l=[],a=Ys(i.parts);if(s.lookupWebResources&&a.length>0)try{o.webResources=await s.lookupWebResources(a)}catch(c){l.push({severity:"warning",code:"webresource-lookup",message:`Couldn't check the ${a.length} referenced web resource(s): ${c instanceof Error?c.message:String(c)}`})}return{findings:[...Wn(i.parts,o),...l],xml:i.xml}}async function ht(e,s,i={}){const o=i.attempts??3,l=i.contentKeys??[];let a={missing:[],unexpected:[],differing:[]};for(let u=0;u<o;u++){u>0&&await new Promise(y=>setTimeout(y,i.delayMs??5e3));try{a=qn(s,await Qe(e),{contentKeys:l})}catch(y){return{ok:!1,missing:[],unexpected:[],differing:[],message:`Couldn't read the published ribbon layer to verify it (${y instanceof Error?y.message:String(y)}).`}}if(a.missing.length===0&&a.unexpected.length===0&&a.differing.length===0){const y=l.length;return{ok:!0,...a,message:"Verified: the published ribbon layer has every element that was imported"+(y>0?`, and the ${y} element(s) this publish changed have the imported content.`:".")}}}const c=u=>u.slice(0,5).join(", ")+(u.length>5?", …":"");return{ok:!1,...a,message:"The published ribbon layer doesn't match what was imported"+(a.missing.length?`; missing: ${c(a.missing)}`:"")+(a.unexpected.length?`; unexpected: ${c(a.unexpected)}`:"")+(a.differing.length?`; different content: ${c(a.differing)}`:"")+". Reload the table and check before publishing again."}}class Ze extends Error{constructor(s,i,o=!1){const l=o?"another solution import ran in the environment meanwhile, and what it changed may not be published yet":Hn(i);super(o?`${s}'s ribbon customizations may have changed in Dataverse since you started publishing: ${l}. Importing could overwrite that change, so nothing was imported. Publish again: the table is published first, so the change is kept.`:`${s}'s ribbon customizations changed in Dataverse since you started publishing (${l}): other ribbon changes for it were published meanwhile, from another session, tool or solution import. Importing would overwrite that change, so nothing was imported. Reload the table to get the change, then publish again.`),this.scopeLabel=s,this.changes=i,this.importRan=o,this.name="RibbonLayerChangedError",this.summary=l}scopeLabel;changes;importRan;summary}function Hn(e){const s=i=>i.slice(0,5).join(", ")+(i.length>5?", …":"");return[e.unexpected.length?`added: ${s(e.unexpected)}`:"",e.missing.length?`removed: ${s(e.missing)}`:"",e.differing.length?`changed: ${s(e.differing)}`:""].filter(Boolean).join("; ")}function mt(e){const s=e instanceof Error?e.message:String(e);return/there is (?:another|a previous) \[(\w+)\] running/i.exec(s)?.[1]??null}const pt=e=>Object.keys(e).flatMap(s=>Array.from(e[s].keys()).map(i=>`${s}:${i}`));function Jn(e,s){const i=[],o=[],l=[];for(const a of Object.keys(e)){for(const[c,u]of e[a]){const y=s[a].get(c);y===void 0?i.push(`${a}:${c}`):y!==u&&l.push(`${a}:${c}`)}for(const c of s[a].keys())e[a].has(c)||o.push(`${a}:${c}`)}return{missing:i,unexpected:o,differing:l}}const Yn=e=>e.missing.length+e.unexpected.length+e.differing.length>0;async function bt(e,s,i,o){const l=o.kind==="imported"?o.attempts??3:1;let a={missing:[],unexpected:[],differing:[]};for(let c=0;c<l;c++){c>0&&o.kind==="imported"&&await new Promise(y=>setTimeout(y,o.delayMs??5e3));const u=await Qe(e);if(a=o.kind==="read"?Jn(i,u):qn(i,u,{contentKeys:pt(i)}),!Yn(a))return}throw new Ze(s,a)}function On(e,s){return nn(()=>gt(e,s)).finally(()=>Bn({afterPublish:!0}))}async function gt(e,s){const i=e.guard??en(),o=Pe.getState(),l=e.entity?e.entity.logicalName:"Application ribbon",a={onProgress:s,...e.busy},c=e.entity===null;if(c&&!e.ribbonCustomizationIds?.length)throw new Error("The selected solution does not contain Application Ribbons. Add it in make.powerapps.com (Solutions → your solution → Add existing → Application Ribbons) and reload the solution.");const u=async(d="Publishing customizations…")=>{s?.(d),await In("Publish",async()=>{c?(await i("Publishing"),await G.execute({operationName:"PublishXml",operationType:"action",parameters:{ParameterXml:"<importexportxml><ribbons><ribbon></ribbon></ribbons></importexportxml>"}})):await ct([e.entity.logicalName],i)},a)},y=e.languageCode??await Os(),T=async d=>{s?.(`Reading existing ribbon customizations for ${l}…`),d&&o.logInfo("publish",`Reading unmanaged ribbon layer for ${l}.`);const k=await Kn({...e,languageCode:y}),A=Wn(k.parts,Gn({...e,publisherPrefix:e.solution.publisherPrefix},k)),r=A.filter(h=>h.severity==="error");if(d||r.length>0){o.logInfo("publish",`RibbonDiffXml for ${l}: ${k.preservedCount} existing element(s) preserved, ${k.changedCount} element(s) from this session, ${k.elementCount} total.`);for(const h of k.scalingChanges)o.logWarn("publish",Vs(h));for(const h of A)h.severity==="warning"&&o.logWarn("publish",h.message)}if(r.length>0){for(const h of r)o.logError("publish",h.message);throw new Error(`The pre-publish check found ${r.length} error(s), so nothing was imported: `+r.map(h=>h.message).join("; "))}return k},P=e.publishCustomizations!==!1?await T(!1):null;s?.("Checking that no other solution operation is running…"),await Us(a);const N=await xt(e.solution);let m=!1;const v=d=>(P&&!m&&d instanceof Error&&(d.message+=` (${l} was published first, so customizations imported elsewhere for it and not yet published are now published.)`),d);if(P){o.logInfo("publish",`Publishing ${l} first, so ribbon changes imported elsewhere but not yet published are kept.`);try{await u(`Publishing ${l} first (keeps changes imported elsewhere but not published)…`)}catch(d){throw d instanceof Error&&(d.message=`Publishing ${l} first failed, so nothing was imported: ${d.message}`),d}}let b;try{b=await T(!0)}catch(d){throw P&&d instanceof Error&&!d.message.startsWith("The pre-publish check")&&(d.message=`${l}'s customizations changed when it was published first (changes imported elsewhere and not yet published): ${d.message} Reload the table to get them, then publish again.`),v(d)}if(P){const d=Jn(P.layer,b.layer);Yn(d)&&o.logInfo("publish",`Publishing ${l} first published ribbon changes imported elsewhere (${Hn(d)}); they are kept.`)}const x=e.entity?.schemaName||e.entity?.logicalName||"",g=c?$n({applicationRibbonDiffXml:b.xml}):$n({entities:[{schemaName:x,localizedName:e.entity?.displayName||x,ribbonDiffXml:b.xml}]}),p=c?[{type:50,schemaName:":RibbonDiffXml",behavior:0}]:[{type:1,schemaName:e.entity.logicalName,behavior:2}],q=jt({...e.solution,languageCode:y,rootComponents:p,details:N});s?.("Packaging solution ZIP…");const H=Xs({"customizations.xml":Ge(g),"solution.xml":Ge(q),"[Content_Types].xml":Ge('<?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="xml" ContentType="application/xml"/></Types>')});let J="";for(let d=0;d<H.length;d++)J+=String.fromCharCode(H[d]);const X=btoa(J),B=async(d,k)=>{s?.(`Importing ${l} ribbon${d}…`);const A=crypto.randomUUID();o.logInfo("publish",`Importing solution${d} (import job ${A})…`);let r=!1;await In("Import",async()=>{if(await i("Importing"),r)throw new Ze(l,{missing:[],unexpected:[],differing:[]},!0);await bt(e.entity?.logicalName??null,l,k.layer,k.as);try{await rt(X,A,i)}catch(_){throw Bs(_)&&mt(_)?.toLowerCase()==="import"&&(r=!0),_}m=!0},a);const h=150,j=2e3;let R=await G.getImportJobStatus(A),S=0;for(;!zn(R)&&S<h;)await new Promise(_=>setTimeout(_,j)),R=await G.getImportJobStatus(A),S++,S%10===0&&s?.(`Still importing… (${S*2}s elapsed)`);if(!zn(R))throw new Error(`Solution import did not complete within ${h*j/1e3} seconds. Check Solutions › History for import job ${A}.`);s?.("Verifying the import…");const W=await G.retrieve("importjob",A,["data"]),Z=lt(W.data,c?{kind:"application"}:{kind:"entity",names:[x,e.entity.logicalName]});if(!Z.ok)throw o.logError("publish",Z.message),new Error(Z.message);return o.logInfo("publish",Z.message),A};let Y;try{Y=await B("",{layer:b.layer,as:{kind:"read"}})}catch(d){throw v(d)}let C;if(e.publishCustomizations!==!1){await u();{o.logInfo("publish","Refreshing Unified Interface command-bar metadata (second import of the same package)…");try{await B(" (refreshing Unified Interface metadata)",{layer:b.parts,as:{kind:"imported",delayMs:e.verifyDelayMs}}),await u()}catch(d){if(d instanceof Ze)C={ok:!1,...d.changes,message:`Your changes were imported and published, but ${l}'s ribbon customizations changed in Dataverse after that (${d.summary}): other changes were published meanwhile. They weren't imported a second time to refresh Unified Interface's command-bar metadata, since that would overwrite the other change, so new or changed buttons may not appear in the app until the table's ribbon is published again. Reload the table to see the other change.`},o.logWarn("publish",C.message);else throw new Error(`Your changes were imported and published, but refreshing Unified Interface's command-bar metadata failed (${d instanceof Error?d.message:String(d)}). New or changed buttons may not appear in the app until you publish again.`)}}C||(s?.("Verifying the published ribbon…"),C=await ht(e.entity?.logicalName??null,b.parts,{delayMs:e.verifyDelayMs,contentKeys:b.changedKeys}),C.ok?o.logInfo("publish",C.message):o.logWarn("publish",C.message))}else o.logWarn("publish","Imported without publishing. New or changed buttons appear in Unified Interface only after you publish from Command Bar Studio (which re-imports once to refresh the command-bar metadata).");return s?.(e.publishCustomizations!==!1?`${l} ribbon published.`:`${l} ribbon imported (not published).`),{elementCount:b.elementCount,preservedCount:b.preservedCount,importJobId:Y,verification:C,parts:b.parts,changedKeys:b.changedKeys}}function ft(e,s){return nn(()=>yt(e,s)).finally(()=>Bn({afterPublish:!0}))}async function yt(e,s){const i=s?.guard??en(),o=Pe.getState(),l=s?.pollIntervalMs??2e3,a=s?.timeoutMs??600*1e3;e?.("Starting asynchronous publish (PublishAllXmlAsync)..."),o.logInfo("publish","Calling PublishAllXmlAsync action."),await i("Publishing");const u=(await G.execute({operationName:"PublishAllXmlAsync",operationType:"action"}))?.AsyncOperationId;if(!u)throw new Error("PublishAllXmlAsync did not return AsyncOperationId.");o.logInfo("publish",`PublishAllXmlAsync job id: ${u}`),e?.("Async publish job started. Waiting for completion...");const y=Date.now();let T=0,P;for(;Date.now()-y<a;){T+=1;const N=await G.retrieve("asyncoperation",u,["asyncoperationid","statecode","statuscode","name","message","friendlymessage","completedon"]);if(P=N.statuscode,N.statecode===3||!!N.completedon){if(typeof N.statuscode=="number"&&N.statuscode!==30){const v=N.friendlymessage||N.message||`statuscode=${N.statuscode}`;throw new Error(`Asynchronous publish failed: ${v}`)}return e?.("Asynchronous publish completed successfully."),o.logInfo("publish",`PublishAllXmlAsync completed in ${T} poll(s).`),{asyncOperationId:u,statusCode:N.statuscode}}e?.(`Waiting for async publish job... (poll ${T})`),await new Promise(v=>setTimeout(v,l))}throw new Error(`Asynchronous publish timed out after ${Math.round(a/1e3)} seconds (last status: ${P??"unknown"}).`)}const Zn=[["AddressTypeCode","addresstypecode"],["City","city"],["County","county"],["Country","country"],["Fax","fax"],["FreightTermsCode","freighttermscode"],["Latitude","latitude"],["Line1","line1"],["Line2","line2"],["Line3","line3"],["Longitude","longitude"],["Name","name"],["PostalCode","postalcode"],["PostOfficeBox","postofficebox"],["PrimaryContactName","primarycontactname"],["ShippingMethodCode","shippingmethodcode"],["StateOrProvince","stateorprovince"],["Telephone1","telephone1"],["Telephone2","telephone2"],["Telephone3","telephone3"],["UPSZone","upszone"],["UTCOffset","utcoffset"],["UTCConversionTimeZoneCode","utcconversiontimezonecode"]];async function xt(e){let s;try{s=(await G.queryData(`solutions?$select=description&$expand=publisherid&$filter=uniquename eq '${e.uniqueName.replace(/'/g,"''")}'`)).value?.[0]}catch(c){throw new Error(`Couldn't read solution ${e.uniqueName} and its publisher (${c instanceof Error?c.message:String(c)}), so nothing was imported: an import without them would clear the publisher's details.`)}const i=s?.publisherid;if(!s||!i)throw new Error(`Couldn't read solution ${e.uniqueName} and its publisher, so nothing was imported: an import without them would clear the publisher's details.`);const o=i.customizationoptionvalueprefix;if(typeof o!="number")throw new Error(`Couldn't read the option-value prefix of publisher ${e.publisherUniqueName}, so nothing was imported: a wrong one would change the publisher.`);const l=c=>typeof c=="string"?c:"",a=[1,2].map(c=>Object.fromEntries(Zn.map(([,u])=>[u,i[`address${c}_${u}`]]).filter(([,u])=>u!=null&&u!==""))).map((c,u)=>({number:u+1,...c}));return{solutionDescription:l(s.description),publisherDescription:l(i.description),publisherEmail:l(i.emailaddress),publisherWebsite:l(i.supportingwebsiteurl),publisherOptionValuePrefix:o,publisherAddresses:a.filter(c=>Object.keys(c).length>1)}}const wt=e=>z(e).replace(/\r/g,"&#xD;").replace(/\n/g,"&#xA;").replace(/\t/g,"&#x9;"),Un=(e,s)=>e?`<Descriptions>
2
- <Description description="${wt(e)}" languagecode="${s}"/>
3
- </Descriptions>`:"<Descriptions/>",Ct=e=>e.length===0?"<Addresses/>":`<Addresses>${e.map(s=>`
4
- <Address>
5
- <AddressNumber>${s.number}</AddressNumber>${Zn.filter(([,i])=>i in s).map(([i,o])=>`
6
- <${i}>${z(String(s[o]))}</${i}>`).join("")}
7
- </Address>`).join("")}
8
- </Addresses>`;function jt(e){const s=e.publisherUniqueName?.trim()||"DefaultPublisher",i=e.publisherName?.trim()||s,o=e.publisherPrefix?.trim()||"new",l=e.languageCode||1033,a=e.friendlyName?.trim()||e.uniqueName,c=e.rootComponents.length===0?"<RootComponents/>":`<RootComponents>
9
- ${e.rootComponents.map(u=>{const y=[`type="${u.type}"`];return u.schemaName&&y.push(`schemaName="${z(u.schemaName)}"`),u.id&&y.push(`id="{${z(u.id)}}"`),y.push(`behavior="${u.behavior}"`),`<RootComponent ${y.join(" ")} />`}).join(`
10
- `)}
11
- </RootComponents>`;return`<?xml version="1.0" encoding="utf-8"?>
12
- <ImportExportXml version="9.1.0.0" SolutionPackageVersion="9.1" languagecode="${l}" generatedBy="CommandBarStudio">
13
- <SolutionManifest>
14
- <UniqueName>${z(e.uniqueName)}</UniqueName>
15
- <LocalizedNames>
16
- <LocalizedName description="${z(a)}" languagecode="${l}"/>
17
- </LocalizedNames>
18
- ${Un(e.details.solutionDescription,l)}
19
- <Version>${z(e.version)}</Version>
20
- <Managed>0</Managed>
21
- <Publisher>
22
- <UniqueName>${z(s)}</UniqueName>
23
- <LocalizedNames>
24
- <LocalizedName description="${z(i)}" languagecode="${l}"/>
25
- </LocalizedNames>
26
- ${Un(e.details.publisherDescription,l)}
27
- <EMailAddress>${z(e.details.publisherEmail)}</EMailAddress>
28
- <SupportingWebsiteUrl>${z(e.details.publisherWebsite)}</SupportingWebsiteUrl>
29
- <CustomizationPrefix>${z(o)}</CustomizationPrefix>
30
- <CustomizationOptionValuePrefix>${e.details.publisherOptionValuePrefix}</CustomizationOptionValuePrefix>
31
- ${Ct(e.details.publisherAddresses)}
32
- </Publisher>
33
- ${c}
34
- <MissingDependencies/>
35
- </SolutionManifest>
36
- </ImportExportXml>`}const vt=Vn({root:{display:"flex",flexDirection:"column",gap:I.spacingVerticalS},box:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:I.spacingHorizontalM,rowGap:I.spacingVerticalXS,padding:`${I.spacingVerticalS} ${I.spacingHorizontalM}`,backgroundColor:I.colorNeutralBackground3,borderRadius:I.borderRadiusMedium},label:{color:I.colorNeutralForeground3},value:{display:"flex",flexWrap:"wrap",alignItems:"center",columnGap:I.spacingHorizontalS,minWidth:0},secondary:{color:I.colorNeutralForeground3,wordBreak:"break-all"}});function Rt({rows:e,confirmWord:s,onConfirmationChange:i,disabled:o}){const l=vt(),[a,c]=$.useState({status:"loading"}),[u,y]=$.useState(""),T=F(p=>p.environment),P=F(p=>p.connectionUrl),N=F(p=>p.connectionVersion);$.useEffect(()=>{let p=!0;return c({status:"loading"}),Fn().then(q=>p&&c({status:"ready",connection:q})).catch(()=>p&&c({status:"ready",connection:null})),()=>{p=!1}},[T,P,N]);const m=a.status==="ready"?a.connection:null,v=qs(m?.environment),b=a.status==="ready"&&Je(m?.environment),x=a.status==="ready"&&(!b||Fs(u,s)),g=m?.environment;return $.useEffect(()=>{i(x,g)},[x,g,i]),n.jsxs("div",{className:l.root,children:[v&&n.jsx(se,{intent:"warning",children:n.jsxs(te,{children:[n.jsx(Ne,{children:"Production environment"}),"This changes the live environment."]})}),n.jsxs("div",{className:l.box,children:[n.jsx(D,{className:l.label,children:"Environment"}),n.jsx("div",{className:l.value,children:a.status==="loading"?n.jsx(D,{children:"Reading the connection…"}):m?n.jsxs(n.Fragment,{children:[n.jsx(D,{weight:"semibold",children:m.name}),m.environment&&n.jsx(Ye,{size:"medium",appearance:v?"filled":"tint",color:v?"warning":"informative",children:m.environment}),n.jsx(D,{size:200,className:l.secondary,children:m.url})]}):n.jsx(D,{children:"Unknown (the tool has no connection)"})}),e.map(p=>n.jsxs("div",{style:{display:"contents"},children:[n.jsx(D,{className:l.label,children:p.label}),n.jsx("div",{className:l.value,children:p.value})]},p.label))]}),b&&n.jsx(ke,{label:n.jsxs(n.Fragment,{children:["Type ",n.jsx("strong",{children:s})," to confirm"]}),hint:"Required on a Production environment.",children:n.jsx(_n,{value:u,onChange:(p,q)=>y(q.value),disabled:o,autoComplete:"off","aria-label":`Type ${s} to confirm`})})]})}const Qn=Vn({content:{display:"flex",flexDirection:"column",gap:I.spacingVerticalM},changes:{listStyleType:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:I.spacingVerticalXS},change:{display:"flex",alignItems:"flex-start",gap:I.spacingHorizontalS},changeIcon:{flexShrink:0,fontSize:"16px",marginTop:"2px",color:I.colorNeutralForeground3},changeText:{flex:1,minWidth:0,overflowWrap:"anywhere"},badge:{flexShrink:0},list:{margin:`${I.spacingVerticalXS} 0 0`,paddingLeft:"20px"},options:{display:"flex",flexDirection:"column",gap:I.spacingVerticalS},timing:{color:I.colorNeutralForeground3},progressList:{display:"flex",flexDirection:"column",gap:I.spacingVerticalXS},progressRow:{display:"flex",alignItems:"center",gap:I.spacingHorizontalS},xmlHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:I.spacingHorizontalS},xml:{height:"360px",border:`1px solid ${I.colorNeutralStroke2}`,borderRadius:I.borderRadiusMedium,overflow:"hidden"}}),St={pending:"Waiting",publishing:"Publishing…",success:"Done",error:"Failed"},$t={pending:"subtle",publishing:"informative",success:"success",error:"danger"},It={new:{text:"New",color:"success",icon:n.jsx(xs,{})},change:{text:"Change",color:"brand",icon:n.jsx(ys,{})},move:{text:"Move",color:"informative",icon:n.jsx(fs,{})},show:{text:"Show",color:"informative",icon:n.jsx(gs,{})},hide:{text:"Hide",color:"warning",icon:n.jsx(bs,{})},delete:{text:"Delete",color:"danger",icon:n.jsx(ps,{})}},Xn=({findings:e,showScope:s})=>{const i=Qn();return n.jsx("ul",{className:i.list,children:e.map((o,l)=>n.jsxs("li",{children:[s&&n.jsxs("strong",{children:[o.scope,": "]}),o.message]},l))})},de=(e,s,i=`${s}s`)=>`${e} ${e===1?s:i}`,Nt=3e4,Ot=()=>{const e=Qn(),s=Nn(t=>t.bulkPublishOpen),i=Nn(t=>t.closeBulkPublish),o=V(t=>t.ribbons),l=V(t=>t.baseline),a=V(t=>t.commands),c=V(t=>t.displayRules),u=V(t=>t.enableRules),y=V(t=>t.baselineCommands),T=V(t=>t.baselineEnableRules),P=V(t=>t.baselineDisplayRules),N=V(t=>t.locLabels),m=V(t=>t.baseLanguageCode),v=V(t=>t.baseLanguageUnknown),b=V(t=>t.setLayerSnapshot),x=V(t=>t.markPublished),g=F(t=>t.activeSolution),p=F(t=>t.activeEntity),q=F(t=>t.connectionUrl),H=F(t=>t.publisherPrefix),J=F(t=>t.solutionRibbonComponentIds),{entityPlan:X,appPlan:B,solutionSupportsAppRibbon:Y,includeApplicationRibbon:C,scopes:d,unsupported:k,warnings:A,changes:r}=Ws(),[h,j]=$.useState(!1),[R,S]=$.useState({}),[W,Z]=$.useState(!1),[_,es]=$.useState(!1),[ue,Te]=$.useState("targeted"),[sn,be]=$.useState(!1),Ae=ue==="allAsync"&&!sn,Ee=F(t=>t.connectionName||t.connectionUrl||"this environment"),[tn,De]=$.useState({confirmed:!1}),ns=re.useCallback((t,f)=>De({confirmed:t,environment:f}),[]),on=tn.confirmed,[ss,an]=$.useState(0),[ln,ie]=$.useState(""),[Le,rn]=$.useState(""),[ge,cn]=$.useState(g?.version??"1.0.0.0"),[ze,fe]=$.useState([]),[dn,un]=$.useState([]),[ts,is]=$.useState(0),[os,ye]=$.useState([]),[xe,Me]=$.useState("summary"),[as,Oe]=$.useState([]),hn=re.useMemo(()=>{const f=(ge||g?.version||"1.0.0.0").split(".").map(L=>Number.parseInt(L,10)||0);for(;f.length<4;)f.push(0);return f[3]+=1,f.slice(0,4).join(".")},[g?.version,ge]);re.useEffect(()=>{cn(g?.version??"1.0.0.0")},[g?.version]);const ls=p&&X?.hasChanges?p.logicalName:"application ribbon",[oe,we]=$.useState("idle"),[Ue,Xe]=$.useState([]),[mn,Ve]=$.useState([]),[pn,Be]=$.useState(""),K=s&&!!g&&k.length===0&&d.length>0,bn=g?.id,gn=g?.publisherPrefix||H,fn=re.useCallback(async()=>{const t={commands:a,enableRules:u,displayRules:c,locLabels:N,baselineCommands:y,baselineEnableRules:T,baselineDisplayRules:P,publisherPrefix:gn,languageCode:m},f={lookupWebResources:M=>Gs(M,bn)},L=[],le=[];if(p&&X?.hasChanges){const M=await Mn({...t,entity:{logicalName:p.logicalName,schemaName:p.schemaName},locations:Re.map(O=>({current:o[O],baseline:l[O]})),plan:X},f);L.push(...M.findings.map(O=>({...O,scope:p.logicalName}))),le.push({scope:p.logicalName,xml:M.xml})}if(C){const M=await Mn({...t,entity:null,locations:[{current:o.Application,baseline:l.Application}],plan:B},f);L.push(...M.findings.map(O=>({...O,scope:"Application ribbon"}))),le.push({scope:"Application ribbon",xml:M.xml})}return{findings:L,xml:le}},[p,X,B,C,o,l,a,u,c,N,y,T,P,gn,bn,m]);re.useEffect(()=>{if(!K||h||W)return;let t=!1;return we("running"),Be(""),ut(fn(),Nt).then(({findings:f,xml:L})=>{t||(Xe(f),Ve(L),we("done"))}).catch(f=>{t||(Xe([]),Ve([]),Be(f instanceof Error?f.message:String(f)),we("failed"))}),()=>{t=!0}},[K,h,W,fn]);const Q=Ue.filter(t=>t.severity==="error"),yn=Ue.filter(t=>t.severity==="warning"),xn=new Set(Ue.map(t=>t.scope)).size>1,wn=K&&(oe==="running"||Q.length>0),rs=()=>nn(async()=>{if(!g||k.length>0||d.length===0||wn||!on||v||Ae)return;j(!0);const t=en(),f=F.getState().connectionVersion,L=()=>F.getState().connectionVersion!==f,le=await Fn().catch(()=>null);if(L()){j(!1);return}if(Je(le?.environment)&&!Je(tn.environment)){De({confirmed:!1}),an(w=>w+1),j(!1),Pe.getState().logWarn("publish",`${le?.name??"The connection"} is a Production environment now: type the confirmation to publish.`);return}ie(""),fe([]),ye([]),un(d),is(r.length),S(Object.fromEntries(d.map(w=>[w,"pending"])));let M=!1;const O=[],Fe={},ne=[],je=[],We=Pe.getState(),me=w=>w instanceof Error?w.message:String(w);Le.trim()&&We.logInfo("publish",`Publish comment: ${Le.trim()}`);const Rn={commands:a,enableRules:u,displayRules:c,locLabels:N,baselineCommands:y,baselineEnableRules:T,baselineDisplayRules:P,publishCustomizations:!0,languageCode:m,solution:{uniqueName:g.uniqueName,friendlyName:g.friendlyName,version:_?hn:ge,publisherUniqueName:g.publisherUniqueName,publisherName:g.publisherName,publisherPrefix:g.publisherPrefix||H,publisherOptionValuePrefix:g.publisherOptionValuePrefix}};if(p&&X?.hasChanges){const w=p.logicalName;S(E=>({...E,[w]:"publishing"}));try{const E=await On({...Rn,guard:t,entity:{logicalName:p.logicalName,schemaName:p.schemaName,displayName:p.displayName},locations:Re.map(U=>({current:o[U],baseline:l[U]})),plan:X},U=>ie(U));O.push(...Re),Fe.entity=E.parts,Hs(q,p.logicalName,E.changedKeys),E.verification&&je.push({scope:w,result:E.verification}),S(U=>({...U,[w]:"success"}))}catch(E){M=!0,ne.push({scope:w,message:me(E)}),We.logError("publish",`Ribbon publish failed (${w}): ${me(E)}`),S(U=>({...U,[w]:"error"}))}}else p&&O.push(...Re);if(C&&!L()){const w="Application ribbon";S(E=>({...E,[w]:"publishing"}));try{const E=await On({...Rn,guard:t,entity:null,locations:[{current:o.Application,baseline:l.Application}],ribbonCustomizationIds:J??[],plan:B},U=>ie(U));O.push("Application"),Fe.application=E.parts,E.verification&&je.push({scope:w,result:E.verification}),S(U=>({...U,[w]:"success"}))}catch(E){M=!0,ne.push({scope:w,message:me(E)}),We.logError("publish",`Application ribbon publish failed: ${me(E)}`),S(U=>({...U,[w]:"error"}))}}else B.hasChanges||O.push("Application");if(!M&&ue==="allAsync")try{await ft(w=>ie(w),{guard:t})}catch(w){M=!0,ne.push({scope:"Publish all customizations",message:me(w)})}if(L()){C&&!ne.some(w=>w.scope==="Application ribbon")&&ne.push({scope:"Application ribbon",message:"Not published: the tool's connection changed during the publish."}),ye(je),fe(ne),Z(!1),j(!1);return}if(x(O,Fe),p&&O.includes("HomepageGrid")&&X?.hasChanges){const w=await kn(p.logicalName);w&&b("entity",w)}if(O.includes("Application")&&C){const w=await kn(null);w&&b("application",w)}M||ie("Done."),ye(je),fe(ne),Z(!M),j(!1)}),Cn=()=>{j(!1),S({}),un([]),Z(!1),ie(""),fe([]),ye([]),we("idle"),Xe([]),Ve([]),Be(""),Me("summary"),Oe([]),De({confirmed:!1}),Te("targeted"),be(!1),rn(""),an(t=>t+1),i()},qe=B.hasChanges&&!Y,Ce=k.length+(K?Q.length:0),jn=K?yn.length+(oe==="failed"?1:0):0;re.useEffect(()=>{Ce>0&&Oe(t=>t.includes("problems")?t:["problems",...t])},[Ce]);const ae=g?v?{intent:"error",title:"Reload the table first",text:"The organization's base language couldn't be read when the table loaded, so labels are shown in English. Publishing now could write English texts as the base language's titles."}:k.length>0?{intent:"error",title:`${de(k.length,"change")} can't be published yet`,text:`Undo ${k.length===1?"it":"them"} to publish the rest. Problems below says what each one is.`}:K&&Q.length>0?{intent:"error",title:`The check found ${de(Q.length,"problem")}`,text:`In what this publish would import. Fix ${Q.length===1?"it":"them"}, then open Publish again; Problems below lists ${Q.length===1?"it":"them"}.`}:d.length===0?qe?{intent:"warning",title:"The application ribbon can't be published from this solution",text:n.jsxs(n.Fragment,{children:["It doesn't include the Application Ribbons component. In make.powerapps.com open the solution, choose"," ",n.jsx("strong",{children:"Add existing → Application Ribbons"}),", then reload here."]})}:{intent:"info",title:"Nothing to publish",text:"Every change on this table is already published."}:Ae?{intent:"warning",title:"Confirm publishing everything",text:`Tick the confirmation under Options to publish every unpublished customization in ${Ee}.`,action:n.jsx(ce,{size:"small",onClick:()=>{Te("targeted"),be(!1)},children:"Only these ribbons"})}:null:{intent:"warning",title:"Choose a solution",text:"Publishing imports into a solution: choose one in the top bar first."},he=p?.displayName||p?.logicalName,vn=!!p&&!!X?.hasChanges,cs=vn&&C?`Publish ${he} and the application ribbon`:!vn&&C?"Publish the application ribbon":he?`Publish ${he}`:"Publish",ds=h?"Publishing…":r.length>0?`Publish ${de(r.length,"change")}`:"Publish",ee=!h&&!W;return n.jsx(_s,{open:s,onOpenChange:t=>!t&&!h&&Cn(),size:xe==="xml"?"large":"medium",title:xe==="xml"?"What Publish imports":cs,startActions:ee?xe==="summary"?n.jsx(ce,{appearance:"subtle",icon:n.jsx(hs,{}),onClick:()=>Me("xml"),children:"View XML"}):n.jsx(ce,{appearance:"subtle",icon:n.jsx(ms,{}),onClick:()=>Me("summary"),children:"Back to summary"}):void 0,actions:n.jsxs(n.Fragment,{children:[n.jsx(ce,{appearance:"secondary",onClick:Cn,disabled:h,children:W?"Close":"Cancel"}),!W&&n.jsx(ce,{appearance:"primary",onClick:()=>{rs()},disabled:h||!g||d.length===0||k.length>0||wn||!on||v||Ae,children:ds})]}),children:xe==="xml"&&ee?n.jsxs("div",{className:e.content,children:[n.jsx(D,{children:"The complete RibbonDiffXml each import writes: your solution's layer as it is now, with your changes merged in."}),K&&oe==="running"?n.jsx(Pn,{size:"tiny",labelPosition:"after",label:"Building the XML…"}):mn.length===0?n.jsx(se,{intent:"info",layout:"multiline",children:n.jsx(te,{children:K&&oe==="failed"?`The XML couldn't be built: ${pn}`:"The XML is built once there is something to publish and nothing blocks it."})}):mn.map(t=>n.jsxs("div",{className:e.options,children:[n.jsxs("div",{className:e.xmlHeader,children:[n.jsx(D,{weight:"semibold",children:t.scope}),n.jsx(ce,{size:"small",appearance:"subtle",icon:n.jsx(us,{}),onClick:()=>{Ks(t.xml)},children:"Copy"})]}),n.jsx("div",{className:e.xml,children:n.jsx(Js,{language:"xml",value:t.xml,readOnly:!0})})]},t.scope))]}):n.jsxs("div",{className:e.content,children:[ee&&ae&&n.jsxs(se,{intent:ae.intent,layout:"multiline",children:[n.jsxs(te,{children:[n.jsx(Ne,{children:ae.title}),ae.text]}),ae.action&&n.jsx(Zs,{children:ae.action})]}),ee&&r.length>0&&n.jsxs("div",{className:e.options,children:[n.jsxs(D,{weight:"semibold",children:[de(r.length,"change")," to publish"]}),n.jsx("ul",{className:e.changes,"aria-label":"Changes to publish",children:r.map((t,f)=>{const L=It[t.kind];return n.jsxs("li",{className:e.change,children:[n.jsx("span",{className:e.changeIcon,"aria-hidden":"true",children:L.icon}),n.jsxs(D,{className:e.changeText,children:[t.action," ",n.jsx("strong",{children:t.name}),t.detail?` ${t.detail}`:""]}),n.jsx(Ye,{appearance:"tint",color:L.color,size:"medium",className:e.badge,children:L.text})]},f)})})]}),ee&&K&&oe==="running"&&n.jsx(Pn,{size:"tiny",labelPosition:"after",label:"Checking what this publish would import…"}),ee&&n.jsx(Rt,{rows:[{label:"Solution",value:g?n.jsx(D,{weight:"semibold",children:g.friendlyName||g.uniqueName}):n.jsx(D,{children:"None selected"})}],confirmWord:ls,onConfirmationChange:ns},ss),ee&&n.jsxs(Qs,{multiple:!0,collapsible:!0,openItems:as,onToggle:(t,f)=>Oe(f.openItems),children:[Ce>0&&n.jsxs(Se,{value:"problems",children:[n.jsxs($e,{children:["Problems · ",Ce]}),n.jsxs(Ie,{children:[k.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(D,{block:!0,children:"These changes can't be published yet; undo them:"}),n.jsx("ul",{className:e.list,children:k.map(t=>n.jsx("li",{children:t},t))})]}),K&&Q.length>0&&n.jsx(Xn,{findings:Q,showScope:xn})]})]}),jn>0&&n.jsxs(Se,{value:"warnings",children:[n.jsxs($e,{children:["Warnings · ",jn]}),n.jsxs(Ie,{children:[n.jsx(D,{block:!0,children:"You can still publish."}),oe==="failed"&&n.jsxs(D,{block:!0,children:["The check before publishing couldn't complete (",pn,"). Publishing runs it again before anything is imported."]}),n.jsx(Xn,{findings:yn,showScope:xn})]})]}),n.jsxs(Se,{value:"info",children:[n.jsxs($e,{children:["Good to know ·"," ",A.length+1+(qe&&d.length>0?1:0)]}),n.jsx(Ie,{children:n.jsxs("ul",{className:e.list,children:[n.jsx("li",{children:"Publishing writes this table's complete ribbon customization: what is already published, plus your changes. Ribbon changes imported elsewhere but not published are published first, so they are kept. Each ribbon is imported twice so Unified Interface picks up the change."}),qe&&d.length>0&&n.jsxs("li",{children:["Your application ribbon changes stay pending: this solution doesn't include the Application Ribbons component. In make.powerapps.com open the solution, choose"," ",n.jsx("strong",{children:"Add existing → Application Ribbons"}),", then reload here."]}),A.map(t=>n.jsx("li",{children:t},t))]})})]}),n.jsxs(Se,{value:"options",children:[n.jsx($e,{children:"Options"}),n.jsxs(Ie,{className:e.options,children:[n.jsx(ke,{label:"Also publish",children:n.jsxs(et,{value:ue==="targeted"?"Only these ribbons":"Every unpublished customization",selectedOptions:[ue],onOptionSelect:(t,f)=>{(f.optionValue==="targeted"||f.optionValue==="allAsync")&&(Te(f.optionValue),be(!1))},children:[n.jsx(Tn,{value:"targeted",children:"Only these ribbons"}),n.jsx(Tn,{value:"allAsync",children:"Every unpublished customization"})]})}),ue==="allAsync"&&n.jsx(se,{intent:"warning",layout:"multiline",children:n.jsxs(te,{children:[n.jsxs(D,{block:!0,children:["This publishes ",n.jsx("strong",{children:"every"})," ","unpublished customization in"," ",n.jsx("strong",{children:Ee}),", not only these ribbons: forms, views, tables and other people's work in progress included."]}),n.jsx(nt,{checked:sn,onChange:(t,f)=>be(f.checked===!0),label:`Publish all unpublished customizations in ${Ee}`})]})}),n.jsx(st,{label:"Increment solution version",checked:_,onChange:(t,f)=>es(f.checked===!0)}),n.jsx(ke,{label:"Solution version",children:n.jsx(_n,{value:_?hn:ge,onChange:(t,f)=>cn(f.value),disabled:_})}),n.jsx(ke,{label:"Publish comment",hint:"Written to the Console log with this publish; it isn't stored in Dataverse.",children:n.jsx(tt,{resize:"vertical",value:Le,onChange:(t,f)=>rn(f.value)})})]})]})]}),ee&&d.length>0&&n.jsx(it,{className:e.timing,children:"Publishing takes 1–4 minutes. Users may need to refresh to see the change."}),ze.length>0&&n.jsx(se,{intent:"error",layout:"multiline",children:n.jsxs(te,{children:[n.jsxs(Ne,{children:["Publish failed (",de(ze.length,"error"),")"]}),n.jsx("ul",{className:e.list,children:ze.map((t,f)=>n.jsxs("li",{style:{fontFamily:I.fontFamilyMonospace},children:[n.jsxs("strong",{children:[t.scope,":"]})," ",t.message]},f))}),n.jsxs("div",{style:{marginTop:I.spacingVerticalS},children:["Full details are in the ",n.jsx("strong",{children:"Console"})," tab of the bottom panel."]})]})}),W&&n.jsx(se,{intent:"success",layout:"multiline",children:n.jsxs(te,{children:[n.jsxs(Ne,{children:["Published ",de(ts,"change"),he&&dn.includes(p?.logicalName??"")?` to ${he}`:""]}),"Unified Interface can take up to about 25 minutes to show it. To see it sooner, run ",n.jsx("strong",{children:"Regenerate ribbon metadata"})," in Command Checker, or hard-refresh the page (Ctrl+F5)."]})}),os.map(t=>n.jsx(se,{intent:t.result.ok?"success":"warning",layout:"multiline",children:n.jsxs(te,{children:[n.jsxs("strong",{children:[t.scope,":"]})," ",t.result.message]})},t.scope)),(h||W)&&n.jsxs("div",{className:e.progressList,children:[dn.map(t=>{const f=R[t]??"pending";return n.jsxs("div",{className:e.progressRow,children:[n.jsx(Ye,{appearance:"filled",color:$t[f],size:"medium",className:e.badge,children:St[f]}),n.jsx(D,{children:t}),f==="publishing"&&n.jsx(ot,{thickness:"large",style:{flex:1}})]},t)}),ln&&!W&&n.jsx(D,{className:e.timing,children:ln})]})]})})};export{Ot as BulkPublishModal,Ot as default};
@@ -1 +0,0 @@
1
- import{L as s,K as ce,ad as U,df as ue,dg as me,s as pe,A as be,ac as he,V as xe,a4 as ge}from"./fluent-icons-CQEhzzaC.js";import{a as I}from"./monaco-BIO15LCS.js";import{D as fe,c as je,S as we,v as ye,f as Ce,C as ve,g as Re}from"./dnd-C1w9VFfC.js";import{b as j,a as x,aj as Ne,aF as Se,u as ke,c as Ae,aG as De,aH as Te,am as Ie,aC as Ee,aI as Be}from"./index-6so8O90C.js";import{C as X}from"./CrmParameterEditor-C22QGWff.js";import{u as Me}from"./useStableKeys-BkDn7til.js";import{b as v,M as q,s as Q,h as b,v as Y,w as Z,x as E,af as J,as as $e,F as C,Y as K,I as _e,T as Fe,X as W,aq as G,a7 as We,L as Le,N as Oe,t as r}from"./fluent-ui-BEjALNLO.js";import"./crmParameters-rgfZhhzN.js";const ee=ce({body:{display:"flex",flexDirection:"column",gap:r.spacingVerticalM},actionCard:{border:`1px solid ${r.colorNeutralStroke2}`,borderRadius:r.borderRadiusMedium,backgroundColor:r.colorNeutralBackground1,padding:r.spacingVerticalM,display:"flex",flexDirection:"column",gap:r.spacingVerticalS},actionHeader:{display:"flex",alignItems:"center",gap:r.spacingHorizontalXS,minWidth:0},actionTitle:{flex:1,minWidth:0},dragHandle:{cursor:"grab",touchAction:"none"},row:{display:"flex",flexWrap:"wrap",gap:r.spacingHorizontalS,alignItems:"flex-end"},library:{display:"flex",gap:r.spacingHorizontalXS,alignItems:"center"},grow:{flex:1,minWidth:0},ruleTags:{flexWrap:"wrap"},muted:{color:r.colorNeutralForeground3},usesList:{listStyleType:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:r.spacingVerticalXS},use:{border:`1px solid ${r.colorNeutralStroke2}`,borderRadius:r.borderRadiusMedium,padding:`${r.spacingVerticalXS} ${r.spacingHorizontalS}`,display:"flex",flexDirection:"column",minWidth:0},fields:{border:"none",margin:0,padding:0,minWidth:0,display:"flex",flexDirection:"column",gap:r.spacingVerticalS,"&:disabled .fui-Input, &:disabled .fui-Select__select, &:disabled .fui-Dropdown, &:disabled .fui-Combobox":{backgroundColor:r.colorNeutralBackground3,borderTopColor:r.colorTransparentStroke,borderRightColor:r.colorTransparentStroke,borderBottomColor:r.colorTransparentStroke,borderLeftColor:r.colorTransparentStroke,color:r.colorNeutralForeground1,cursor:"default"},"&:disabled .fui-Input::after, &:disabled .fui-Dropdown::after, &:disabled .fui-Combobox::after":{display:"none"},"&:disabled input, &:disabled .fui-Dropdown__button":{color:r.colorNeutralForeground1,cursor:"default"},"&:disabled .fui-Select__icon, &:disabled .fui-Dropdown__expandIcon, &:disabled .fui-Combobox__expandIcon":{display:"none"},"&:disabled .fui-Button":{color:r.colorNeutralForegroundDisabled,borderTopColor:r.colorNeutralStrokeDisabled,borderRightColor:r.colorNeutralStrokeDisabled,borderBottomColor:r.colorNeutralStrokeDisabled,borderLeftColor:r.colorNeutralStrokeDisabled,cursor:"not-allowed"}}}),Pe=[],Ve=n=>{const d=n.trim();return d.startsWith("$webresource:")?d.slice(13).trim():d};function ze(n){switch(n.kind){case"javascript":return"Run JavaScript";case"url":return"Open a URL";case"powerFx":return"Power Fx (not supported)";case"customApi":return"Custom API (not supported)";case"outlookCommand":return"Outlook command";case"raw":return n.tagName;default:return"Action"}}function He({id:n,index:d,count:u,title:R,readOnly:g,onMove:N,onRemove:B,children:w}){const y=ee(),{attributes:M,listeners:A,setNodeRef:S,setActivatorNodeRef:D,transform:T,transition:$}=Ce({id:n,disabled:g});return s.jsxs("section",{ref:S,style:{transform:ve.Transform.toString(T),transition:$},className:y.actionCard,"aria-label":`Action ${d+1}: ${R}`,children:[s.jsxs("div",{className:y.actionHeader,children:[!g&&u>1&&s.jsx(b,{ref:D,appearance:"subtle",size:"small",className:y.dragHandle,icon:s.jsx(ue,{}),"aria-label":"Drag to reorder action",...M,...A}),s.jsx(v,{weight:"semibold",className:y.actionTitle,truncate:!0,wrap:!1,children:R}),!g&&u>1&&s.jsxs(q,{children:[s.jsx(Q,{disableButtonEnhancement:!0,children:s.jsx(b,{appearance:"subtle",size:"small",icon:s.jsx(me,{}),"aria-label":"More for this action"})}),s.jsx(Y,{children:s.jsxs(Z,{children:[s.jsx(E,{icon:s.jsx(pe,{}),disabled:d===0,onClick:()=>N(d,d-1),children:"Move up"}),s.jsx(E,{icon:s.jsx(be,{}),disabled:d===u-1,onClick:()=>N(d,d+1),children:"Move down"})]})})]}),!g&&s.jsx(Fe,{content:"Remove action",relationship:"label",children:s.jsx(b,{appearance:"subtle",size:"small",icon:s.jsx(he,{}),onClick:B})})]}),w]})}const Ze=()=>{const n=ee(),d=j(e=>e.commandEditorOpen),u=j(e=>e.commandEditorId),R=j(e=>e.closeCommandEditor),g=j(e=>e.openRuleEditor),N=j(e=>e.openScriptView),B=j(e=>e.openWebResourceBrowser),w=j(e=>e.commandEditorTab),y=x(e=>e.commands),M=x(e=>e.upsertCommand),A=x(e=>e.ribbons),S=x(e=>e.locLabels),D=x(e=>e.displayRules),T=x(e=>e.enableRules),$=x(e=>e.upsertEnableRule),se=x(e=>e.upsertDisplayRule),_=Ne(),[ae,L]=I.useState(""),[re,O]=I.useState(""),l=y.find(e=>e.id===u),m=Me(`actions:${l?.id??""}`,l?.actions??Pe),f=Se(ke(l?.id));I.useEffect(()=>{d&&u&&!l&&R()},[d,u,l,R]);const P=I.useMemo(()=>u?Ae(A,u):[],[A,u]);if(!l)return null;const k=e=>{M({...l,...e})},h=(e,a)=>{const t=[...l.actions];t[e]=a,k({actions:t}),m.update()},ne=e=>{k({actions:l.actions.filter((a,t)=>t!==e)}),m.remove(e)},V=(e,a)=>{a<0||a>=l.actions.length||e===a||(k({actions:Re(l.actions,e,a)}),m.move(e,a))},oe=e=>{e.over&&V(m.keys.indexOf(String(e.active.id)),m.keys.indexOf(String(e.over.id)))},z=e=>{const a=e==="javascript"?{kind:"javascript",library:"",functionName:"",params:[]}:{kind:"url",address:"https://",params:[]};k({actions:[...l.actions,a]}),m.add()},le=(e,a)=>{if(e.kind==="javascript"){const t=Ve(e.library);return s.jsxs(s.Fragment,{children:[s.jsxs("fieldset",{disabled:f,className:n.fields,children:[s.jsx(C,{label:"Library",hint:"A JavaScript web resource, like $webresource:publisher_/scripts/file.js.",children:s.jsxs("div",{className:n.library,children:[s.jsx(W,{className:n.grow,value:e.library,onChange:(o,c)=>h(a,{...e,library:c.value.replace(/^(\s*\$webresource:\s*)+/i,"$webresource:")}),placeholder:"$webresource:publisher_/scripts/file.js"}),s.jsx(b,{onClick:()=>{Ee.set(o=>{h(a,{...e,library:`$webresource:${o.name}`})}),B()},children:"Browse…"})]})}),s.jsx(C,{label:"Function",hint:"The function's full name, including its namespace.",children:s.jsx(W,{value:e.functionName,onChange:(o,c)=>h(a,{...e,functionName:c.value}),placeholder:"Contoso.Account.approve"})}),s.jsx(G,{weight:"semibold",children:"Parameters, in order"}),s.jsx(X,{params:e.params,onChange:o=>h(a,{...e,params:o}),urlMode:!1})]}),s.jsxs("div",{className:n.row,children:[s.jsx(b,{size:"small",icon:s.jsx(xe,{}),disabled:!t,onClick:()=>N(t,!1),children:"View script"}),!f&&s.jsx(b,{size:"small",icon:s.jsx(ge,{}),disabled:!t,onClick:()=>N(t,!0),children:"Edit script"})]})]})}if(e.kind==="url"){const t=e.address.trim().startsWith("https://");return s.jsxs("fieldset",{disabled:f,className:n.fields,children:[s.jsx(C,{label:"Address",validationState:t?"none":"error",validationMessage:t?void 0:"The address must start with https://",children:s.jsx(W,{value:e.address,onChange:(o,c)=>h(a,{...e,address:c.value}),placeholder:"https://"})}),s.jsx(C,{label:"Open in",children:s.jsxs(K,{value:String(e.winMode??0),onChange:(o,c)=>h(a,{...e,winMode:parseInt(c.value)}),children:[s.jsx("option",{value:"0",children:"Navigate (0)"}),s.jsx("option",{value:"1",children:"Dialog (1)"}),s.jsx("option",{value:"2",children:"Popup (2)"})]})}),s.jsx(C,{hint:"Adds the record's details to the address: typename, type, id, orgname and the user's languages.",children:s.jsx(We,{label:"Pass parameters",checked:!!e.passParams,onChange:(o,c)=>h(a,{...e,passParams:c.checked?!0:void 0})})}),s.jsx(G,{weight:"semibold",children:"Query string parameters"}),s.jsx(X,{params:e.params,onChange:o=>h(a,{...e,params:o}),urlMode:!0})]})}return e.kind==="powerFx"||e.kind==="customApi"?s.jsx(Le,{intent:"error",children:s.jsxs(Oe,{children:["Classic ribbon commands can't run"," ",e.kind==="powerFx"?"Power Fx":"Custom API"," actions, so this command can't be published while it has one. Remove it and use a JavaScript function instead (for example, call the API with"," ",s.jsx("code",{children:"Xrm.WebApi.online.execute"}),"), or build the command with modern commanding in the app designer."]})}):e.kind==="outlookCommand"||e.kind==="raw"?s.jsx(v,{size:200,className:n.muted,children:e.kind==="outlookCommand"?`ActionType="${e.actionType}"${e.data?` Data="${e.data}"`:""}`:e.xml}):null},te=()=>s.jsxs(s.Fragment,{children:[s.jsx(fe,{collisionDetection:je,onDragEnd:oe,children:s.jsx(we,{items:m.keys,strategy:ye,children:l.actions.map((e,a)=>s.jsx(He,{id:m.keys[a],index:a,count:l.actions.length,title:ze(e),readOnly:f,onMove:V,onRemove:()=>ne(a),children:le(e,a)},m.keys[a]))})}),l.actions.length===0&&s.jsx(v,{className:n.muted,children:"No actions yet. The button does nothing when it's clicked."}),!f&&s.jsx("div",{children:s.jsxs(q,{children:[s.jsx(Q,{disableButtonEnhancement:!0,children:s.jsx(b,{icon:s.jsx(U,{}),children:"Add action"})}),s.jsx(Y,{children:s.jsxs(Z,{children:[s.jsx(E,{onClick:()=>z("javascript"),children:"Run JavaScript"}),s.jsx(E,{onClick:()=>z("url"),children:"Open a URL"})]})})]})}),s.jsx(J,{className:n.muted,children:"Every user's browser gets the command's definition, even when the button is hidden. Don't put secrets in function names or parameters."})]}),H=e=>{const a=e==="enable"?l.enableRules:l.displayRules,t=(e==="enable"?T:D).map(i=>i.id).filter(i=>!a.includes(i)),o=e==="enable"?ae:re,c=i=>k(e==="enable"?{enableRules:i}:{displayRules:i}),de=()=>{const i=new Set([...T.map(F=>F.id),...D.map(F=>F.id)]),p=Be("New",e==="enable"?"Enable":"Display",i);e==="enable"?$({id:p,steps:[]}):se({id:p,steps:[]}),c([...a,p]),g(p,e)};return s.jsxs(s.Fragment,{children:[a.length>0?s.jsx($e,{className:n.ruleTags,"aria-label":e==="enable"?"Enable rules":"Display rules",children:a.map(i=>s.jsx(Te,{ruleId:i,kind:e,onOpen:()=>g(i,e),onRemove:f?void 0:()=>c(a.filter(p=>p!==i))},i))}):s.jsxs(v,{className:n.muted,children:["No ",e," rules, so the button is always"," ",e==="enable"?"enabled":"shown","."]}),!f&&s.jsxs("div",{className:n.row,children:[s.jsx(C,{label:`Add an existing ${e} rule`,style:{flex:"1 1 260px",minWidth:0},children:s.jsxs(K,{style:{width:"100%",maxWidth:"100%",minWidth:0},value:o,onChange:(i,p)=>e==="enable"?L(p.value):O(p.value),children:[s.jsx("option",{value:"",children:"Select a rule…"}),t.map(i=>s.jsx("option",{value:i,children:i},i))]})}),s.jsx(b,{disabled:!o,onClick:()=>{o&&(c([...a,o]),e==="enable"?L(""):O(""))},children:"Add"}),s.jsxs(b,{appearance:"subtle",icon:s.jsx(U,{}),onClick:de,children:["New ",e," rule"]})]}),e==="enable"&&s.jsx(_e,{size:"small",info:"Disabled buttons are hidden in the modern command bar (Unified Interface). In the classic ribbon, they stay visible but do nothing when clicked.",children:"What a failing enable rule does"})]})},ie=()=>P.length===0?s.jsx(v,{className:n.muted,children:"No button uses this command."}):s.jsx("ul",{className:n.usesList,"aria-label":"Buttons using this command",children:P.map(({location:e,tab:a,group:t,button:o})=>s.jsxs("li",{className:n.use,children:[s.jsx(v,{weight:"semibold",truncate:!0,wrap:!1,children:_(o.label,S,void 0,o.source?.labelToken)||o.id}),s.jsx(J,{className:n.muted,children:[Ie[e].label,_(a.label,S)||a.id,_(t.label,S)||t.id].join(" › ")})]},`${e}:${a.id}:${t.id}:${o.id}`))});return s.jsxs("div",{className:n.body,children:[s.jsx(De,{commandId:l.id,hideBadge:!0}),w==="actions"&&te(),w==="enable"&&H("enable"),w==="display"&&H("display"),w==="usedBy"&&ie()]})};export{Ze as CommandEditorPanel,Ze as default};
@@ -1 +0,0 @@
1
- import{L as s,m as ie,K as re}from"./fluent-icons-CQEhzzaC.js";import{a as k}from"./monaco-BIO15LCS.js";import{b as c,a as d,aj as ce,R as de,ak as ue,a6 as S,al as pe,ae as me,s as he,am as be}from"./index-6so8O90C.js";import{D as fe,d as ge,a8 as xe,af as m,B as ke,b as ne,t as n}from"./fluent-ui-BEjALNLO.js";import"./dnd-C1w9VFfC.js";const we=re({surface:{width:"calc(100vw - 32px)",maxWidth:"640px",padding:0,alignSelf:"flex-start",marginTop:"10vh",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"calc(80vh)"},search:{padding:n.spacingVerticalM,borderBottom:`1px solid ${n.colorNeutralStroke2}`},searchBox:{width:"100%",maxWidth:"none"},results:{overflowY:"auto",padding:`${n.spacingVerticalXS} 0`,minHeight:0,flex:1},groupLabel:{display:"block",padding:`${n.spacingVerticalS} ${n.spacingHorizontalM} ${n.spacingVerticalXXS}`,color:n.colorNeutralForeground3,fontWeight:n.fontWeightSemibold},item:{display:"flex",alignItems:"center",gap:n.spacingHorizontalS,padding:`${n.spacingVerticalS} ${n.spacingHorizontalM}`,cursor:"pointer",minWidth:0},itemActive:{backgroundColor:n.colorNeutralBackground1Selected,boxShadow:`inset 2px 0 0 ${n.colorBrandStroke1}`},kind:{flexShrink:0,minWidth:"72px",justifyContent:"center"},itemText:{flex:1,minWidth:0,display:"flex",flexDirection:"column"},itemLabel:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},itemSub:{color:n.colorNeutralForeground3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},more:{display:"block",padding:`${n.spacingVerticalXXS} ${n.spacingHorizontalM}`,color:n.colorNeutralForeground3},empty:{display:"block",padding:n.spacingVerticalL,textAlign:"center",color:n.colorNeutralForeground3},footer:{display:"flex",flexWrap:"wrap",gap:n.spacingHorizontalL,padding:`${n.spacingVerticalS} ${n.spacingHorizontalM}`,borderTop:`1px solid ${n.colorNeutralStroke2}`,color:n.colorNeutralForeground3}}),ye={action:"Action",button:"Button",command:"Command",enable:"Enable rule",display:"Display rule",table:"Table"},ve=[{kinds:["action"],title:"Actions",limit:1/0},{kinds:["button"],title:"Buttons",limit:20},{kinds:["command"],title:"Commands",limit:30},{kinds:["enable","display"],title:"Rules",limit:30},{kinds:["table"],title:"Tables",limit:30}],D=a=>`palette-${a.replace(/[^\w-]/g,"_")}`,Ie=()=>{const a=we(),C=c(e=>e.commandPaletteOpen),se=c(e=>e.setCommandPaletteOpen),R=c(e=>e.openBulkPublish),T=c(e=>e.openXmlDrawer),w=c(e=>e.openImportXml),E=c(e=>e.openCommandEditor),X=c(e=>e.openRuleEditor),O=c(e=>e.openNewGroup),A=c(e=>e.openNewButton),V=c(e=>e.openLocalizationEditor),W=d(e=>e.undo),z=d(e=>e.redo),H=d(e=>e.past.length>0),P=d(e=>e.future.length>0),F=d(e=>e.commands),G=d(e=>e.displayRules),U=d(e=>e.enableRules),j=d(e=>e.ribbons),N=d(e=>e.locLabels),$=ce(),_=de(e=>e.entities),q=ue(e=>e.requestEntitySwitch),I=S(e=>e.location),K=S(e=>e.tabId),Y=S(e=>e.selectedButtonId),L=S(e=>e.selectedGroupId),Q=S(e=>e.selectButtonInContext),[x,Z]=k.useState(""),[ae,h]=k.useState(0),J=k.useRef(null),ee=()=>{se(!1),Z(""),h(0)},y=x.startsWith("/")?"actions":x.startsWith("@")?"tables":"all",M=(y==="all"?x:x.slice(1)).trim().toLowerCase(),te=k.useMemo(()=>{if(!C)return[];const e=[],t=j[I].tabs.find(o=>o.id===K),i=L??t?.groups[0]?.id??null,u=pe(t?.groups.find(o=>o.id===L),Y),p=(o,r,l,f)=>e.push({id:`act-${o}`,label:r,subtitle:l,kind:"action",run:f});p("publish","Publish…","Review and publish your changes",R),p("view-xml","View XML","The XML of your changes",()=>T(I)),p("import-xml","Import XML…","Import RibbonDiffXml from the clipboard",()=>{const o="Couldn't read the clipboard here: paste the XML into the editor (Ctrl+V).",r=navigator.clipboard?.readText?.();if(!r)return w("",o);r.then(l=>l.trim().startsWith("<")?w(l):w("","The clipboard doesn't hold XML: paste the XML into the editor."),()=>w("",o))}),t&&p("new-group","New group…","In the current tab",O),i&&p("new-button","New button…","In the selected or first group",()=>A(i)),u&&!me(u.kind)&&(u.origin===void 0||u.origin==="unmanaged")&&p("translations","Translations…","The selected button's text",()=>V(u.id)),H&&p("undo","Undo","Ctrl+Z",W),P&&p("redo","Redo","Ctrl+Y",z);for(const[o,r]of Object.entries(j))for(const l of r.tabs)for(const f of l.groups)for(const g of he(f))e.push({id:`btn-${o}-${g.id}`,label:$(g.label,N,void 0,g.source?.labelToken)||g.id,subtitle:[be[o].label,$(l.label,N,void 0,l.source?.titleToken)||l.id,$(f.label,N,void 0,f.source?.titleToken)||f.id].join(" › "),keywords:`${g.label} ${g.id}`,kind:"button",run:()=>Q(o,l.id,f.id,g.id)});for(const o of F)e.push({id:`cmd-${o.id}`,label:o.id,subtitle:`${o.actions.length} action${o.actions.length===1?"":"s"}`,kind:"command",run:()=>E(o.id)});for(const[o,r]of[[U,"enable"],[G,"display"]])for(const l of o)e.push({id:`${r}-${l.id}`,label:l.id,subtitle:`${l.steps.length} step${l.steps.length===1?"":"s"}`,kind:r,run:()=>X(l.id,r)});for(const o of _)e.push({id:`ent-${o.logicalName}`,label:o.displayName,subtitle:o.logicalName,kind:"table",run:()=>q(o)});return e},[C,j,I,K,L,Y,H,P,F,U,G,_,N,$,R,T,w,O,A,V,E,X,W,z,Q,q]),B=k.useMemo(()=>{const e=t=>!M||[t.label,t.subtitle??"",t.keywords??""].some(i=>i.toLowerCase().includes(M));return ve.filter(t=>y==="all"||y==="actions"&&t.kinds.includes("action")||y==="tables"&&t.kinds.includes("table")).map(t=>{const i=te.filter(u=>t.kinds.includes(u.kind)&&e(u));return{...t,shown:i.slice(0,t.limit),more:Math.max(0,i.length-t.limit)}}).filter(t=>t.shown.length>0)},[te,M,y]),v=B.flatMap(e=>e.shown),b=v[Math.min(ae,v.length-1)];k.useEffect(()=>{b&&J.current?.querySelector(`#${D(b.id)}`)?.scrollIntoView?.({block:"nearest"})},[b]);const oe=e=>{e&&(ee(),e.run())},le=e=>{e.key==="ArrowDown"?(e.preventDefault(),h(t=>Math.min(t+1,v.length-1))):e.key==="ArrowUp"?(e.preventDefault(),h(t=>Math.max(t-1,0))):e.key==="Home"?(e.preventDefault(),h(0)):e.key==="End"?(e.preventDefault(),h(v.length-1)):e.key==="Enter"&&(e.preventDefault(),oe(b))};return s.jsx(fe,{open:C,onOpenChange:(e,t)=>!t.open&&ee(),children:s.jsxs(ge,{className:a.surface,"aria-label":"Command palette",children:[s.jsx("div",{className:a.search,children:s.jsx(xe,{className:a.searchBox,size:"large",autoFocus:!0,placeholder:"Search buttons, commands, rules and tables",value:x,onChange:(e,t)=>{Z(t.value),h(0)},input:{role:"combobox","aria-label":"Search","aria-expanded":!0,"aria-controls":"palette-results","aria-activedescendant":b?D(b.id):void 0,"aria-autocomplete":"list",onKeyDown:le}})}),s.jsxs("div",{ref:J,id:"palette-results",role:"listbox","aria-label":"Results",className:a.results,children:[B.map(e=>s.jsxs("div",{role:"group","aria-label":e.title,children:[s.jsx(m,{className:a.groupLabel,role:"presentation",children:e.title}),e.shown.map(t=>{const i=t===b;return s.jsxs("div",{id:D(t.id),role:"option","aria-selected":i,className:ie(a.item,i&&a.itemActive),onClick:()=>oe(t),onMouseMove:()=>h(v.indexOf(t)),children:[s.jsx(ke,{className:a.kind,appearance:"tint",size:"medium",color:t.kind==="action"?"brand":"informative",children:ye[t.kind]}),s.jsxs("span",{className:a.itemText,children:[s.jsx(ne,{className:a.itemLabel,children:t.label}),t.subtitle&&s.jsx(m,{className:a.itemSub,children:t.subtitle})]})]},t.id)}),e.more>0&&s.jsxs(m,{className:a.more,role:"presentation",children:[e.more," more: keep typing to narrow it down."]})]},e.title)),B.length===0&&s.jsxs(ne,{className:a.empty,role:"presentation",children:["Nothing matches “",x,"”."]})]}),s.jsxs("div",{className:a.footer,"aria-hidden":"true",children:[s.jsx(m,{children:"↑ ↓ move"}),s.jsx(m,{children:"Enter choose"}),s.jsx(m,{children:"Esc close"}),s.jsx(m,{children:"/ actions only"}),s.jsx(m,{children:"@ tables only"})]})]})})};export{Ie as CommandPalette,Ie as default};
@@ -1,7 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./monaco-BIO15LCS.js","./monaco-DdLsZAcA.css"])))=>i.map(i=>d[i]);
2
- import{R as h,a as S,_}from"./monaco-BIO15LCS.js";import{L as e,d9 as z,K as $}from"./fluent-icons-CQEhzzaC.js";import{b as A,a as E,aN as C,g as F,aO as P}from"./index-6so8O90C.js";import{b as y,t as l,h as X,af as H,B as D,ah as V,ai as k,ag as I}from"./fluent-ui-BEjALNLO.js";import"./dnd-C1w9VFfC.js";const U=h.lazy(()=>_(()=>import("./monaco-BIO15LCS.js").then(t=>t.i),__vite__mapDeps([0,1]),import.meta.url).then(t=>({default:t.DiffEditor}))),W=["HomepageGrid","SubGrid","Form","Application"],G=$({root:{flex:1,display:"flex",flexDirection:"column",gap:l.spacingVerticalS,minHeight:"320px"},unchanged:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:l.spacingVerticalM,textAlign:"center",color:l.colorNeutralForeground3},bar:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:l.spacingHorizontalS},spacer:{flex:1},muted:{color:l.colorNeutralForeground3},editor:{flex:1,minHeight:"240px",border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium,overflow:"hidden",position:"relative"},loading:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"}});function q(t,n){const d=t.split(`
3
- `),s=n.split(`
4
- `);let a=0,c=0;const b=new Set(d),x=new Set(s);for(const m of s)b.has(m)||a++;for(const m of d)x.has(m)||c++;return{added:a,removed:c}}function j(t,n,d=!1){return W.map(s=>{const a=d?n[s]:t.ribbons[s];try{return`<!-- ${s} -->
5
- `+F({location:s,current:a,baseline:n[s],commands:t.commands,displayRules:t.displayRules,enableRules:t.enableRules,locLabels:t.locLabels,entityLogicalName:a.entityLogicalName})}catch(c){return`<!-- ${s}: Error generating XML: ${String(c)} -->`}}).join(`
6
-
7
- `)}const ee=({historyIndex:t})=>{const n=G(),d=A(i=>i.themeMode),s=t!==void 0,[a,c]=h.useState(!0),[b,x]=h.useState(!1),m=E(i=>!s&&i.mutationsSincePublish===0&&!P(i)),r=E(),o=s?r.past[t]:void 0,v=S.useMemo(()=>s?o?j(o.snapshot,r.baseline):"":j(r,r.baseline,!0),[s,o]),u=s?r.past[t+1]?.snapshot??C(r):C(r),L=S.useMemo(()=>s&&!o?"":j(u,r.baseline),[s,o,u.ribbons,u.commands,u.displayRules,u.enableRules,u.locLabels,r.baseline]),{added:N,removed:R}=q(v,L),M=h.useRef(null),B=h.useCallback(i=>{M.current=i,i.updateOptions({renderSideBySide:a});const p=[i.getOriginalEditor(),i.getModifiedEditor()];let g=0;const O=()=>{g||(g=requestAnimationFrame(()=>{g=0;for(const f of p)f.render(!0)}))},T=p.flatMap(f=>{const w=f.onDidChangeModelTokens;return w?[w.call(f,O)]:[]});i.onDidDispose(()=>{cancelAnimationFrame(g);for(const f of T)f.dispose()})},[]);return h.useEffect(()=>{M.current?.updateOptions({renderSideBySide:a})},[a]),s&&!o?e.jsx("div",{className:n.unchanged,children:e.jsx(y,{children:"This change was undone, so there's nothing to show."})}):!s&&!b&&m?e.jsxs("div",{className:n.unchanged,children:[e.jsx(z,{fontSize:40,color:l.colorPaletteGreenForeground1,"aria-hidden":"true"}),e.jsx(y,{size:500,weight:"semibold",children:"No changes since the last publish"}),e.jsx(y,{children:"What you see matches what's published for this table."}),e.jsx(X,{onClick:()=>x(!0),children:"Show the full XML anyway"})]}):e.jsxs("div",{className:n.root,children:[e.jsx(H,{className:n.muted,children:s?`${[o.op,o.target].filter(Boolean).join(" ")}${o.detail?` (${o.detail})`:""}: the XML before it (left) and after it (right).`:"The published XML (left) and the XML with your changes (right)."}),e.jsxs("div",{className:n.bar,children:[e.jsxs(D,{appearance:"tint",color:N?"success":"informative",children:["+",N," lines"]}),e.jsxs(D,{appearance:"tint",color:R?"danger":"informative",children:["-",R," lines"]}),e.jsx("div",{className:n.spacer}),e.jsxs(V,{size:"small",selectedValue:a?"side":"unified",onTabSelect:(i,p)=>c(p.value==="side"),"aria-label":"Diff layout",children:[e.jsx(k,{value:"side",children:"Side by side"}),e.jsx(k,{value:"unified",children:"Unified"})]})]}),e.jsx("div",{className:n.editor,children:e.jsx(S.Suspense,{fallback:e.jsx("div",{className:n.loading,children:e.jsx(I,{size:"small",label:"Loading the diff…"})}),children:e.jsx(U,{original:v,modified:L,language:"xml",theme:d==="dark"?"vs-dark":"vs",height:"100%",onMount:B,options:{readOnly:!0,renderSideBySide:a,lineNumbers:"on",minimap:{enabled:!1},scrollBeyondLastLine:!1,automaticLayout:!0,wordWrap:"on"}})})})]})};export{ee as CompareView,ee as default};
@@ -1 +0,0 @@
1
- import{L as e,s as g,A as b,i as j,ad as y,K as I}from"./fluent-icons-CQEhzzaC.js";import{R as P}from"./monaco-BIO15LCS.js";import{U as k}from"./crmParameters-rgfZhhzN.js";import{F as v,Y as f,X as S,a7 as R,T as p,h,t as u}from"./fluent-ui-BEjALNLO.js";const N=I({root:{display:"flex",flexDirection:"column",gap:u.spacingVerticalXS,minWidth:0},param:{display:"flex",flexWrap:"wrap",minWidth:0,gap:u.spacingHorizontalS,alignItems:"flex-end",padding:u.spacingVerticalXS,border:`1px solid ${u.colorNeutralStroke2}`,borderRadius:u.borderRadiusMedium},typeSelect:{flex:"0 1 170px",minWidth:"130px"},nameField:{flex:"0 1 150px",minWidth:"110px"},valueField:{flex:"1 1 160px",minWidth:0,"& .fui-Select, & .fui-Input, & select":{width:"100%",minWidth:0}},actions:{display:"flex",gap:u.spacingHorizontalXS,flexShrink:0},addButton:{alignSelf:"flex-start"}}),A=[{label:"Context",values:["PrimaryControl","PrimaryControlId","SelectedControl","CommandProperties"]},{label:"Record",values:["PrimaryEntityTypeCode","PrimaryEntityTypeName","FirstPrimaryItemId","PrimaryItemIds"]},{label:"Selection context",values:["SelectedEntityTypeCode","SelectedEntityTypeName","FirstSelectedItemId"]},{label:"Grid selection",values:["SelectedControlSelectedItemCount","SelectedControlSelectedItemIds","SelectedControlSelectedItemReferences","SelectedControlAllItemCount","SelectedControlAllItemIds","SelectedControlAllItemReferences","SelectedControlUnselectedItemCount","SelectedControlUnselectedItemIds","SelectedControlUnselectedItemReferences"]},{label:"Org/User",values:["OrgName","OrgLcid","UserLcid"]}];function F({value:r,integer:c,onChange:x}){const[i,s]=P.useState(String(r));return P.useEffect(()=>s(Number.isFinite(r)?String(r):""),[r]),e.jsx(S,{type:"number",value:i,onChange:(C,d)=>{s(d.value);const m=Number(d.value);d.value.trim()!==""&&Number.isFinite(m)&&(!c||Number.isInteger(m))&&!/e/i.test(String(m))&&x(m)},onBlur:()=>s(Number.isFinite(r)?String(r):"")})}const z=({params:r,onChange:c,urlMode:x=!1})=>{const i=N(),s=(l,t)=>{const a=[...r];a[l]=t,c(a)},C=l=>{c(r.filter((t,a)=>a!==l))},d=(l,t)=>{const a=[...r],n=l+t;n<0||n>=a.length||([a[l],a[n]]=[a[n],a[l]],c(a))},m=()=>{c([...r,{kind:"CrmParameter",value:"PrimaryControl"}])};return e.jsxs("div",{className:i.root,children:[r.map((l,t)=>e.jsxs("div",{className:i.param,children:[e.jsx(v,{label:"Type",size:"small",className:i.typeSelect,children:e.jsxs(f,{value:l.kind,onChange:(a,n)=>{const o=n.value;o==="CrmParameter"?s(t,{kind:o,value:"PrimaryControl"}):o==="BoolParameter"?s(t,{kind:o,value:!1}):o==="IntParameter"||o==="DecimalParameter"?s(t,{kind:o,value:0}):s(t,{kind:"StringParameter",value:""})},children:[e.jsx("option",{value:"CrmParameter",children:"From the context"}),e.jsx("option",{value:"StringParameter",children:"Text"}),e.jsx("option",{value:"BoolParameter",children:"True or false"}),e.jsx("option",{value:"IntParameter",children:"Whole number"}),e.jsx("option",{value:"DecimalParameter",children:"Decimal number"})]})}),x&&e.jsx(v,{label:"Name",size:"small",className:i.nameField,validationState:l.kind==="CrmParameter"&&!l.name?"error":"none",validationMessage:l.kind==="CrmParameter"&&!l.name?"Needs a name: it's the query string key.":void 0,children:e.jsx(S,{value:l.name??"",onChange:(a,n)=>s(t,{...l,name:n.value||void 0}),placeholder:"key"})}),e.jsx(v,{label:"Value",size:"small",className:i.valueField,children:l.kind==="CrmParameter"?e.jsx(f,{value:l.value,onChange:(a,n)=>s(t,{...l,value:n.value}),children:A.map(a=>e.jsx("optgroup",{label:a.label,children:a.values.filter(n=>!x||!k.has(n)).map(n=>e.jsx("option",{value:n,children:n},n))},a.label))}):l.kind==="BoolParameter"?e.jsx(R,{checked:l.value,onChange:(a,n)=>s(t,{...l,value:n.checked}),label:l.value?"True":"False"}):l.kind==="StringParameter"?e.jsx(S,{value:String(l.value),onChange:(a,n)=>s(t,{...l,value:n.value})}):e.jsx(F,{value:l.value,integer:l.kind==="IntParameter",onChange:a=>s(t,{...l,value:a})})}),e.jsxs("div",{className:i.actions,children:[e.jsx(p,{content:`Move parameter ${t+1} up`,relationship:"label",children:e.jsx(h,{appearance:"subtle",size:"small",icon:e.jsx(g,{}),onClick:()=>d(t,-1),disabled:t===0})}),e.jsx(p,{content:`Move parameter ${t+1} down`,relationship:"label",children:e.jsx(h,{appearance:"subtle",size:"small",icon:e.jsx(b,{}),onClick:()=>d(t,1),disabled:t===r.length-1})}),e.jsx(p,{content:`Remove parameter ${t+1}`,relationship:"label",children:e.jsx(h,{appearance:"subtle",size:"small",icon:e.jsx(j,{}),onClick:()=>C(t)})})]})]},t)),e.jsx(h,{className:i.addButton,appearance:"secondary",size:"small",icon:e.jsx(y,{}),onClick:m,children:"Add parameter"})]})};export{z as C};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CommandEditorPanel-DsCP9yG4.js","./fluent-icons-CQEhzzaC.js","./monaco-BIO15LCS.js","./monaco-DdLsZAcA.css","./dnd-C1w9VFfC.js","./fluent-ui-BEjALNLO.js","./index-6so8O90C.js","./index-D5GCH8nj.css","./CrmParameterEditor-C22QGWff.js","./crmParameters-rgfZhhzN.js","./useStableKeys-BkDn7til.js","./RuleEditorPanel-l8QnRFj6.js","./ruleKinds-BKTUiZ1-.js","./ScriptView-BVyCmRvD.js","./MonacoEditor-BMKRZv-g.js","./TabDisplayRulesPanel-gORq6MO7.js","./XmlView-Bn4KlTw3.js","./CompareView-DGsrcdoN.js","./TranslationsView-DubBATog.js"])))=>i.map(i=>d[i]);
2
- import{a as u,_ as y}from"./monaco-BIO15LCS.js";import{L as e,K as E,a4 as w,cm as N,i as V,m as S}from"./fluent-icons-CQEhzzaC.js";import{u as L,a as x,b as g,I as D,c as z,i as B}from"./index-6so8O90C.js";import{F as P,X as A,h as j,t as l,T as C,B as F,ah as H,ai as R,af as v,U as W,aY as O,aZ as X,n as $,p as I,a_ as U,a$ as M,ag as K,b0 as Y}from"./fluent-ui-BEjALNLO.js";import"./dnd-C1w9VFfC.js";const Z=E({rename:{display:"flex",alignItems:"flex-start",gap:l.spacingHorizontalS,marginTop:l.spacingVerticalXS},field:{flex:1,minWidth:0},input:{fontFamily:l.fontFamilyMonospace},buttons:{display:"flex",gap:l.spacingHorizontalXS,marginTop:"22px"}});function q(s,i,m,p){if(!s.trim())return"Enter an ID.";if(/\s/.test(s))return"An ID can't contain spaces.";if(s!==i&&m.some(c=>c.toLowerCase()===s.toLowerCase()))return`Another ${p} already has this ID.`}function T({label:s,current:i,ids:m,what:p,hint:c,onRename:f,onDone:h}){const r=Z(),[a,b]=u.useState(i),o=q(a,i,m,p),n=()=>{const d=a.trim();!o&&d!==i&&f(d),h()};return e.jsxs("div",{className:r.rename,children:[e.jsx(P,{className:r.field,label:s,validationState:o?"error":"none",validationMessage:o,hint:o?void 0:c,children:e.jsx(A,{className:r.input,value:a,autoFocus:!0,onChange:(d,t)=>b(t.value),onKeyDown:d=>{d.key==="Enter"&&n(),d.key==="Escape"&&(d.stopPropagation(),h())}})}),e.jsxs("div",{className:r.buttons,children:[e.jsx(j,{appearance:"primary",disabled:!!o||a.trim()===i,onClick:n,children:"Rename"}),e.jsx(j,{onClick:h,children:"Cancel"})]})]})}const G=E({idRow:{display:"flex",alignItems:"center",gap:l.spacingHorizontalS,minWidth:0,marginTop:l.spacingVerticalXS},id:{flex:1,minWidth:0},badge:{flexShrink:0},tabs:{marginTop:l.spacingVerticalS,marginLeft:`calc(-1 * ${l.spacingHorizontalM})`}}),J={custom:{text:"Yours",color:"success"},customising:{text:"Your copy",color:"brand"},customised:{text:"Your copy",color:"brand"},oob:{text:"Read-only",color:"informative"},uncustomising:{text:"Read-only",color:"informative"},reloadRequired:{text:"Read-only",color:"informative"}};function Q({commandId:s}){const i=G(),m=L(s)?.provenance,p=x(t=>t.commands.find(_=>_.id===s)),c=x(t=>z(t.ribbons,s).length),f=g(t=>t.commandEditorTab),h=g(t=>t.setCommandEditorTab),r=x(t=>t.commands).map(t=>t.id),a=x(t=>t.renameCommandId),b=g(t=>t.openCommandEditor),[o,n]=u.useState(!1),d=m&&J[m];return e.jsxs(e.Fragment,{children:[o?e.jsx(T,{label:"Command ID",current:s,ids:r,what:"command",hint:"Usually publisher.Table.Button.Command. Its buttons follow the new ID.",onRename:t=>a(s,t)&&b(t),onDone:()=>n(!1)}):e.jsxs("div",{className:i.idRow,children:[e.jsx("div",{className:i.id,children:e.jsx(D,{label:"Command ID",value:s,hideLabel:!0,action:m==="custom"&&e.jsx(C,{content:"Rename command ID",relationship:"label",children:e.jsx(j,{appearance:"subtle",icon:e.jsx(w,{}),onClick:()=>n(!0)})})})}),d&&e.jsx(F,{appearance:"tint",color:d.color,size:"medium",className:i.badge,children:d.text})]}),e.jsxs(H,{className:i.tabs,selectedValue:f,onTabSelect:(t,_)=>h(_.value),children:[e.jsx(R,{value:"actions",children:"Actions"}),e.jsxs(R,{value:"enable",children:["Enable rules (",p?.enableRules.length??0,")"]}),e.jsxs(R,{value:"display",children:["Display rules (",p?.displayRules.length??0,")"]}),e.jsxs(R,{value:"usedBy",children:["Used by (",c,")"]})]})]})}const ee=E({idRow:{display:"flex",alignItems:"center",gap:l.spacingHorizontalS,minWidth:0,marginTop:l.spacingVerticalXS},id:{flex:1,minWidth:0},usedBy:{color:l.colorNeutralForeground3}});function ae({ruleId:s,kind:i}){const m=ee(),p=x(n=>i==="enable"?n.enableRules:n.displayRules),c=x(n=>n.commands.filter(d=>(i==="enable"?d.enableRules:d.displayRules).includes(s)).length),f=x(n=>n.renameEnableRuleId),h=x(n=>n.renameDisplayRuleId),r=g(n=>n.openRuleEditor),[a,b]=u.useState(!1),o=n=>{(i==="enable"?f(s,n):h(s,n))&&r(n,i)};return e.jsxs(e.Fragment,{children:[a?e.jsx(T,{label:"Rule ID",current:s,ids:p.map(n=>n.id),what:"rule",hint:"The commands that use it follow the new ID.",onRename:o,onDone:()=>b(!1)}):e.jsx("div",{className:m.idRow,children:e.jsx("div",{className:m.id,children:e.jsx(D,{label:"Rule ID",value:s,hideLabel:!0,action:!B(s)&&e.jsx(C,{content:"Rename rule ID",relationship:"label",children:e.jsx(j,{appearance:"subtle",icon:e.jsx(w,{}),onClick:()=>b(!0)})})})})}),e.jsxs(v,{className:m.usedBy,children:["Used by ",c," command",c===1?"":"s"]})]})}const se=u.lazy(()=>y(()=>import("./CommandEditorPanel-DsCP9yG4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url)),ne=u.lazy(()=>y(()=>import("./RuleEditorPanel-l8QnRFj6.js"),__vite__mapDeps([11,1,2,3,6,5,4,7,12,8,9,10]),import.meta.url)),ie=u.lazy(()=>y(()=>import("./ScriptView-BVyCmRvD.js"),__vite__mapDeps([13,1,2,3,6,5,4,7,14]),import.meta.url)),te=u.lazy(()=>y(()=>import("./TabDisplayRulesPanel-gORq6MO7.js"),__vite__mapDeps([15,1,2,3,6,5,4,7,10]),import.meta.url)),oe=u.lazy(()=>y(()=>import("./XmlView-Bn4KlTw3.js"),__vite__mapDeps([16,1,2,3,6,5,4,7,14]),import.meta.url)),le=u.lazy(()=>y(()=>import("./CompareView-DGsrcdoN.js"),__vite__mapDeps([17,2,3,1,6,5,4,7]),import.meta.url)),re=u.lazy(()=>y(()=>import("./TranslationsView-DubBATog.js"),__vite__mapDeps([18,1,2,3,6,5,4,7]),import.meta.url)),de=E({drawer:{width:"720px",maxWidth:"90vw"},wide:{width:"960px"},fill:{display:"flex",flexDirection:"column"},navigation:{justifyContent:"space-between"},title:{display:"flex",flexDirection:"column",gap:l.spacingVerticalXXS,minWidth:0},trail:{color:l.colorNeutralForeground3},idRow:{display:"flex",alignItems:"center",gap:l.spacingHorizontalS,minWidth:0,marginTop:l.spacingVerticalXS},id:{flex:1,minWidth:0},footer:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:l.spacingHorizontalM},hint:{color:l.colorNeutralForeground3}});function k(s){return s.kind==="command"?"Edit command":s.kind==="rule"?`Edit ${s.ruleKind} rule`:s.kind==="tabRules"?"Tab display rules":s.kind==="xml"?"XML of your changes":s.kind==="translations"?"Translations":s.kind==="diff"?s.id==="compare"?"Compare with published":"What this change did":s.editable?"Edit script":"View script"}function he(){const s=de(),i=g(o=>o.editorStack),m=g(o=>o.editorBack),p=g(o=>o.closeEditor),c=i.length>0,[f,h]=u.useState(i);c&&i!==f&&h(i);const r=c?i:f,a=r[r.length-1],b=r[r.length-2];return u.useEffect(()=>c?(x.getState().beginEditSession(),()=>x.getState().endEditSession()):void 0,[c]),e.jsxs(W,{position:"end",open:c,onOpenChange:(o,n)=>!n.open&&p(),className:S(s.drawer,(a?.kind==="xml"||a?.kind==="diff")&&s.wide),"aria-label":a?k(a):"Editor",children:[e.jsxs(O,{children:[e.jsx(X,{children:e.jsxs($,{className:s.navigation,children:[b?e.jsx(I,{appearance:"subtle",icon:e.jsx(N,{}),onClick:m,children:k(b)}):e.jsx("span",{}),e.jsx(I,{appearance:"subtle",icon:e.jsx(V,{}),"aria-label":"Close",onClick:p})]})}),a&&e.jsx(U,{children:e.jsxs("span",{className:s.title,children:[r.length>2&&e.jsxs(v,{className:s.trail,children:[r.slice(0,-1).map(k).join(" › ")," ›"]}),k(a)]})}),a?.kind==="command"&&e.jsx(Q,{commandId:a.id},a.id),a?.kind==="rule"&&e.jsx(ae,{ruleId:a.id,kind:a.ruleKind},a.id),(a?.kind==="script"||a?.kind==="tabRules"||a?.kind==="translations")&&e.jsx("div",{className:s.idRow,children:e.jsx("div",{className:s.id,children:e.jsx(D,{label:a.kind==="tabRules"?"Tab ID":a.kind==="translations"?"Button ID":"Web resource",value:a.id,hideLabel:!0})})})]}),e.jsx(M,{className:S((a?.kind==="script"||a?.kind==="xml"||a?.kind==="diff")&&s.fill),children:e.jsxs(u.Suspense,{fallback:e.jsx(K,{size:"small",label:"Loading…"}),children:[a?.kind==="command"&&e.jsx(se,{}),a?.kind==="rule"&&e.jsx(ne,{}),a?.kind==="tabRules"&&e.jsx(te,{location:a.location,tabId:a.id}),a?.kind==="script"&&e.jsx(ie,{name:a.id,editable:a.editable},a.id),a?.kind==="xml"&&e.jsx(oe,{location:a.id},a.id),a?.kind==="translations"&&e.jsx(re,{buttonId:a.id},a.id),a?.kind==="diff"&&e.jsx(le,{historyIndex:a.historyIndex},`${a.id}:${a.historyIndex??""}`)]})}),e.jsxs(Y,{className:s.footer,children:[e.jsx(v,{className:s.hint,children:a?.kind==="script"?a.editable?"Save writes the script to Dataverse · Undo doesn't revert it":"":a?.kind==="xml"||a?.kind==="diff"?"":"Changes apply as you edit · Ctrl Z to undo"}),e.jsx(j,{appearance:"primary",onClick:p,children:"Done"})]})]})}export{he as EditorDrawer,he as default};
@@ -1 +0,0 @@
1
- import{L as c}from"./fluent-icons-CQEhzzaC.js";import{b as i,a as n,aj as b,aD as m,aE as p,al as f}from"./index-6so8O90C.js";import"./monaco-BIO15LCS.js";import"./fluent-ui-BEjALNLO.js";import"./dnd-C1w9VFfC.js";const R=()=>{const o=i(e=>e.hideInsteadOfDelete),a=i(e=>e.closeHideInsteadOfDelete),s=i(e=>e.announce),t=n(e=>o?f(e.ribbons[o.location].tabs.find(d=>d.id===o.tabId)?.groups.find(d=>d.id===o.groupId),o.buttonId):void 0),l=n(e=>o?e.baseline[o.location]:void 0),r=n(e=>e.locLabels),u=b();return!o||!t||!l?null:c.jsx(m,{open:!0,buttonLabel:u(t.label,r,void 0,t.source?.labelToken),buttonId:t.id,commandId:t.commandId,deleteBlockedReason:p(t,l),onConfirmHide:()=>{n.getState().hideOobButton(o.location,o.tabId,o.groupId,o.buttonId),s("Button hidden"),a()},onConfirmDisplayRule:()=>{n.getState().hideWithDisplayRules(t.commandId)&&s("Button hidden"),a()},onCancel:a})};export{R as HideInsteadOfDeleteModal,R as default};