import{l as p}from"./lodash-CdDiHlzQ.js";import{P as c}from"./PzText-D5PUnIjq.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./iframe-Bl-fVlm8.js";import"./preload-helper-C1FmrZbK.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";const n=100;class o{static minPriceStep(t,r){return!t||r===void 0?0:r/t}static multiplyByHundredPercent(t){if(!p.isNumber(t)&&p.isEmpty(t))return"";const r=parseFloat(t)*n;return`${Math.round(r*n)/n}%`}}const P={title:"Utilities/PzPriceFormat",parameters:{docs:{description:{component:"The `PzPriceFormat` static class provides common utilities for rendering pricing values such as minimum steps or formatting decimal percents into percent strings."}}}},i={render:()=>({components:{pzText:c},setup(){return{minPriceExamples:[{value:1e3,step:10,description:"Value 1000, minimal step 10"},{value:50,step:2,description:"Value 50, step 2"},{value:0,step:5,description:"Zero value"}].map(e=>({...e,result:o.minPriceStep(e.value,e.step)})),percentExamples:[{value:.12345,description:"Standard fractional"},{value:1,description:"Complete ratio"},{value:"0.55",description:"String fractional"}].map(e=>({...e,result:o.multiplyByHundredPercent(e.value)}))}},template:`
      <div style="display: flex; flex-direction: column; gap: 24px;">
        <section>
          <pz-text variant="h4-semibold">minPriceStep</pz-text>
          <ul style="margin-top: 16px; padding-left: 20px;">
            <li v-for="(ex, index) in minPriceExamples" :key="'min-' + index" style="margin-top: 8px;">
              <pz-text variant="body-regular">
                <strong>{{ ex.description }}:</strong> Value: <code>{{ ex.value }}</code>, Step: <code>{{ ex.step }}</code> &rarr; Result: <code>{{ ex.result }}</code>
              </pz-text>
            </li>
          </ul>
        </section>

        <section>
          <pz-text variant="h4-semibold">multiplyByHundredPercent</pz-text>
          <ul style="margin-top: 16px; padding-left: 20px;">
            <li v-for="(ex, index) in percentExamples" :key="'pct-' + index" style="margin-top: 8px;">
              <pz-text variant="body-regular">
                <strong>{{ ex.description }}:</strong> Input: <code>{{ ex.value }}</code> &rarr; Result: <code>{{ ex.result }}</code>
              </pz-text>
            </li>
          </ul>
        </section>
      </div>
    `})};var s,a,l;i.parameters={...i.parameters,docs:{...(s=i.parameters)==null?void 0:s.docs,source:{originalSource:`{
  render: () => ({
    components: {
      pzText: PzText
    },
    setup() {
      return {
        minPriceExamples: [{
          value: 1000,
          step: 10,
          description: "Value 1000, minimal step 10"
        }, {
          value: 50,
          step: 2,
          description: "Value 50, step 2"
        }, {
          value: 0,
          step: 5,
          description: "Zero value"
        }].map(ex => ({
          ...ex,
          result: PzPriceFormat.minPriceStep(ex.value, ex.step)
        })),
        percentExamples: [{
          value: 0.12345,
          description: "Standard fractional"
        }, {
          value: 1,
          description: "Complete ratio"
        }, {
          value: "0.55",
          description: "String fractional"
        }].map(ex => ({
          ...ex,
          result: PzPriceFormat.multiplyByHundredPercent(ex.value)
        }))
      };
    },
    template: \`
      <div style="display: flex; flex-direction: column; gap: 24px;">
        <section>
          <pz-text variant="h4-semibold">minPriceStep</pz-text>
          <ul style="margin-top: 16px; padding-left: 20px;">
            <li v-for="(ex, index) in minPriceExamples" :key="'min-' + index" style="margin-top: 8px;">
              <pz-text variant="body-regular">
                <strong>{{ ex.description }}:</strong> Value: <code>{{ ex.value }}</code>, Step: <code>{{ ex.step }}</code> &rarr; Result: <code>{{ ex.result }}</code>
              </pz-text>
            </li>
          </ul>
        </section>

        <section>
          <pz-text variant="h4-semibold">multiplyByHundredPercent</pz-text>
          <ul style="margin-top: 16px; padding-left: 20px;">
            <li v-for="(ex, index) in percentExamples" :key="'pct-' + index" style="margin-top: 8px;">
              <pz-text variant="body-regular">
                <strong>{{ ex.description }}:</strong> Input: <code>{{ ex.value }}</code> &rarr; Result: <code>{{ ex.result }}</code>
              </pz-text>
            </li>
          </ul>
        </section>
      </div>
    \`
  })
}`,...(l=(a=i.parameters)==null?void 0:a.docs)==null?void 0:l.source}}};const z=["Usage"];export{i as Usage,z as __namedExportsOrder,P as default};
